vendredi 4 mars 2016

Laravel get all related models for multiple models

I have a users table and a groups table. I have set up a many to many users/groups relations. When I run

$users = User::where("id",'=',6)->first()->groups;

,I get the right group.

But I will have cases where my queries will take in an array of users. How do I get all the groups of all those users using laravel relationships ?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1TVIryH
via IFTTT

Aucun commentaire:

Enregistrer un commentaire