I've got the following tables in the DB architecture:
- users (id, name, surname)
- teams (id, name)
- roles (id, name)
- permissions (id, name)
- team_role_permission (team_id, role_id, permission_id)
- team_user (user_id, team_id, role_id)
My goal is to describe the relation between team, role and permission models. I read the Laravel documentation and there's no way to use the pivot table with 3 relations. Actually, I'll use only 3 relations:
- In what teams the player is and what is his role in each team (method
teams
in theUser/Player
model) - Which players are in the team and what is their roles (method
players
in theTeam
model)
But I don't understand how to use it with laravel relations?
The table team_role_permission
and it's relations have to be, because team creator should be able to edit permissions for his (each) team manually.