Please enable / Bitte aktiviere JavaScript!
Veuillez activer / Por favor activa el Javascript![ ? ]
How to get related tables? - bug-code.com Q&A

How to get related tables?

0 like 0 dislike
23 views
Have a project where in the database 3 tables, users, sites list and the table containing a list of websites tied to users. As from the model user to obtain a list of sites ?
//table: users, sites, site_user
asked by | 23 views

2 Answers

0 like 0 dislike
User::find($userId)->sites();
But in the models needs to be spelled out
answered by
0 like 0 dislike
answered by
Welcome to Bug-code Q&A, where you can ask questions and receive answers from other members of the community.

24.8k questions

46.2k answers

0 comments

12.3k users

24,788 questions
46,220 answers
0 comments
12,337 users