i'm a little confused, i need to implements a user role according to an trade unions that the user belongs. The user can belongs to a lot of trade unions but his role can be different.
The migrations will be:
+-----------+ +-----------+ +---------------+ +-------------------+
| users | | roles | | tradeunions | | user_role_trade |
+-----------+ +-----------+ +---------------+ +-------------------+
| id | | id | | id | | user_id |
| name | | name | | name | | role_id |
+-----------+ +-----------+ +---------------+ | trade_id |
+-------------------+
What would be the best way to do it? I've worked with pivot table with two models, but with three, I'm a bit confused Thanks a lot !
You can make a UserRoleTrade Model for your pivot table.
Then implement the required functions like the relationship between the User Model and this Model.