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

jackFlick's avatar

Inverse Relationship

This seems to be a simple question but I'm trying to figure it out.

I have the below Models


Student -> BelongsTo Course

Course -> BelongsToMany Teachers

Teacher-> BelongsToMany Courses

This means that Teacher is linked to Student via Courses

Now I want to pull the Students with Teachers

Thank you in advance for all your help.

0 likes
6 replies
Sinnbeck's avatar

Is it correct that a student can only ever have one course?

2 likes

Please or to participate in this conversation.