I have a project model where I want to associate roles and then users. The roles is a subset of the system roles (Spatie Permission) I have a relation table (Project Roles) with the subset of roles pointing to Spatie Roles. Then I have a Project Role Resources pivot table where I link users and their role to a project.
My challenge is that I can't figure out how I can jump to the associated users trough the Project Roles table as it has no relation with the projects. All projects will have the same subset so the table acts more like a filter.
What I want to archive is something like this: $ProjectRoles = Project->Roles (Getting the subset of system roles) foreach ($ProjectRoles as role) $role->users (Getting the associated users)
If the roles was not a subset of system roles, then it would be easy. But the "fake relationship" kill me...
Any help or better ideas are highly appreciated.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community