Complex User, Group and Role Relationship #233
-
Hi, I use this awesome package together with https://github.com/staudenmeir/laravel-merged-relations. I have quiet a complex scenario:
Now I want to achieve the following: Is that possible and how could I accomplish that? I am not sure if I can merge multiple views in one view? Greetings and thanks so much for these awesome packages! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
I tried to update the existing view with this migration:
But this runs into an SQL error:
This is how I updated my
Can you help me out on this @staudenmeir ? Thanks in advance! |
Beta Was this translation helpful? Give feedback.
-
Hi @nilskretschmer, Replace
In the end, the |
Beta Was this translation helpful? Give feedback.
-
Hey @staudenmeir |
Beta Was this translation helpful? Give feedback.
Hi @nilskretschmer,
It's not possible to nest merged relationships like this, but you should be able to achieve your goal with a different approach.
Replace
(new User)->rolePermissions()
and(new User)->groupPermissions()
with their "original" relationships. So replace(new User)->rolePermissions()
with two deep relationships:User
->Role
->Permission
User
->Role
->Group
->Permission
In the end, the
Schema::createOrReplaceMergeView()
call should have five relationships. Do you know what I mean?