Back

Get all team members job sites if current user is the owner


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 :)


Sign in to participate in this thread!



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