I'm new to Laravel 5.1 and I'm currently working on a project to familiarize with Laravel on my own.
I have many tables in my application but I'm getting stuck on a specific multiple relation between 3 tables (that maybe should use Pivot tables).
So, I have 3 tables :
- Roles
- Users
- Projects
The following rules apply to the relationships :
- A user can have 0 to many projects
- A project can be accessed by many different users
- A user is granted some rights on a specific project depending on his role
- A user has an "active" project which is the one the application gets its data from. Users can change their "active" project from the projects list.
(permissions are linked to roles and allow a user with a specific role to perform a defined set of actions on a project)
I initially had a Users <-> Roles which worked well (as far as code is concerned) but the role defined for a user permitted to do a predefined set of things on every project (which is not flexible enough to me).
I already saw another post with approx. the same title as mine but I'm afraid this can't address my needs because the properties are held on the intersection table though in my case, I already have the physical tables.