Support the ongoing development of Laravel.io →
Laravel Spark Eloquent

Hello, i am plugging away at my app and i am required to have team owners to be able to edit / update / delete all of the the team members job sites but i am not sure how to build the proper query. I currently have this query to retrieve the sites for the current user

$jobSites =  DB::table('job_sites')->where('user_id', auth()->id())->get();

but i am not sure how to modify it so i can get the job sites for all of the users on a given team if the current user is the owner of the team. I tried looking through the docs but only see conditional logic for team stuff and nothing seemed obvious to me.

Any suggestions would be extremely helpful!! thanks in advance :)

Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.