I already posted this on the laravel forums, but no one could help. Thought I'd post a second opinion here.
I need a little tutorial / help on how to structure my models. This is what i am trying to do
A user can be a member of several teams, but a user can play a different role in each team.
The idea is that the user sees a different set of data / functions depending on the role they occupy in the team.
So, I thought of something like:
Users
id, name, email, etc...
Teams
id, name, description
Roles
id, name
Team Users
user_id, team_id, role_id
The table team_memberswill tie 3 parts together. Defining user groups and their roles.
My questions:
- This is the best way to go on such a relationship.
- How to assign a user to a team with a role?
- Using Eloquent, how do I get the user role in this command?