I have 3 tables: Project
, Group
, User
and one relation pivot table: project_group
with colmuns: id
project_id
group_id
and pivot field user_id
I know how to take all Groups and Projects:
Project::find(1)->groups()->get();
groups()
is belongToMany function inside Project Model.
Problem is I don't know how to get all users for particular project. I need to get project and all users names and ids for that project, any solution for this?
Thanks in advance
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1T4rb6x
via IFTTT
Aucun commentaire:
Enregistrer un commentaire