For example: I have these models in my application.
User
, Profile
, Interest
.
I linked the users
table with the profiles
table by adding the user_id
column in the profiles
table. And I linked profiles
and interests
by using a pivot table (interest_profile
), Which is (as obvious) will have two columns (profile_id
, interest_id
).
However, I want to query the users who are associated with a profile, too see who is associated with a particular interest, In other words: "select all users who are having (in their profiles) that particular interest".
I know that I can do this with raw SQL by joining the four tables and then use (where clause).. But I want to do it the Laravel way.
Thanks in advance.