Assigning permissions to a role can not work when using multiple guards #2479
Replies: 6 comments 15 replies
-
Laravel version? Package version? Seems like you forgot fixing migration on pivots |
Beta Was this translation helpful? Give feedback.
-
Show your migration, |
Beta Was this translation helpful? Give feedback.
-
Please post your \App\Models\Permission model. If you're using UUID you need to use the HasUuids trait (or manually implement all the UUID logic. |
Beta Was this translation helpful? Give feedback.
-
That's a bit unusual. But as long as the user has at least one role already assigned, then yes you can do that. |
Beta Was this translation helpful? Give feedback.
-
In a fresh new app, using multiple guards, using teams, and using UUIDs work as documented. And the test suite tests all those things. Therefore the problem is in how you've adapted/modified things further. It could be in your custom models. It could be in your migrations. It could be in the way you're using teams (vs the documentation). After reviewing both of your open discussions, it's apparent that there's more information needed in order for us to provide further help. The best way to provide enough information is to post your application code to a github repository so we can inspect it. |
Beta Was this translation helpful? Give feedback.
-
Errors in your application:
return [
'models' => [
- 'permission' => Spatie\Permission\Models\Permission::class,
+ 'permission' => App\Models\Permission::class,
- 'role' => Spatie\Permission\Models\Role::class,
+ 'role' => App\Models\Role::class,
],
-organizaitons
+organizations
I think only # 1 in this list is "important". |
Beta Was this translation helpful? Give feedback.
-
Error following:
Why does
permission_id
change fromUUID
toint
? I used uuid.All permissions and the admin role are the same guard.
Beta Was this translation helpful? Give feedback.
All reactions