This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

ogvnr
ogvnr

Hi, I'm trying to create a three-way relationship with a pivot table.

What I have 4 models; Movies, Peoples, PeopleRoles, and MovieCast.

I currently have a DB schema like so:

movies_

| id | name       |
|----|------------|
| 1  | Fight Club |
| 2  | Inception  |

movies_peoples

| id | name       |
|----|------------|
| 1  | Brad Pitt  |
| 2  | Tom Cruise |

movies_peoples_roles

| id | name       |
|----|------------|
| 1  | Director   |
| 2  | Writers    |

movies_casts (pivot table)

| (pk) movie_id | (pk) role_id |  (pk) people_id |
|---------------|--------------|-----------------|
| 1             | 1            | 1               |
| 1             | 1            | 2               |
| 1             | 2            | 1               |
| 2             | 1            | 2               |

Currently I have no idea how to do this. What is the best solution to implement this kind of relation?

1-1 of 1

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.