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

HT-ftw's avatar

Relationships between 3 tables

Hi Guys, I have these 3 tables:

Jobs
- id
- name
Measures
- id
- name
Jobs_Measures
- job_id
- measure_id

Each Job can have multiple Measures and each Measure can be assigned multiple Jobs. What would be the best way to define eloquent relationships in such a scenerio? Thanks for any tips. HT

0 likes
3 replies
DhPandya's avatar

@ht-ftw You should also add job_id to your measures table. It will helps you to retrive the messaures of your jobs.

Randy_Johnson's avatar

@DhPandya You don't need to add job_id to your measures because you have already referenced it in the M2M table. HT-ftw just read the information on the url I sent you.

Please or to participate in this conversation.