Realtion in Pivot Table

Posted 1 year ago by mdeorue

Hi guys,

I need your help, first sorry for my english, is too bad.

Well, I have 2 tables, teams and players, so I got a Many to Many relation, player_team, but in a team some players have different positions, like captain, etc... I made a column in player_team pivot table, that indicates the player position, captain, trainer, etc... And this column has a relation with player_positions.

I need that when I use belongsToMany relation I got the player_position relation eager load. So when I want the players of a team, I got there position too.

Thank you a lot for your help.

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.