Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

latz's avatar
Level 3

Problems with Many to Many Relationship

Hi, i have a many to many relationship. This raw sql show the desired result:

select player_id
FROM player_training
INNER JOIN players
ON players.id = player_training.player_id
WHERE training_id = 2

How can i get the same result with eloquent?

I have three tables:

  • players
  • trainings
  • player_training

I need the data from a trainingday.

0 likes
1 reply

Please or to participate in this conversation.