Start here https://laracasts.com/discuss?q=3+tables
Aug 31, 2017
2
Level 1
Which relation to use for 3 tables (belongsToMany)?
I have 3 tables, to connect data correctly I use a table between 2 tables with data.
It looks exactly so:

There are teams and players, I want to get players of a team. Which relation is there possible? I tried with belongsToMany() but I was not able to figure it correctly.
Level 122
Just use 3 models. Team and Player both have Group in a BelongsTo relationship.
Group has a hasMany relationship with Team and Player
$teamMembers = $team->group()->players()->get();
or $team = Team::with(group.players)->find(1); and then players are nested in the collection $team->group->players
Please or to participate in this conversation.