No able to assignRole when using team? #2129
Unanswered
clickervinod
asked this question in
Q&A
Replies: 2 comments 4 replies
-
Beta Was this translation helpful? Give feedback.
0 replies
-
Lots of people, including myself, run into this problem. I'm sorry to say that the documentation regarding this point is a mess. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am not able to assign role ( $user->assignRole('customer') / $user->assignRole($role) ) when uing team getting below error
Spatie \ Permission \ Exceptions \ RoleDoesNotExist There is no role named
customer.
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'team_id' cannot be nul l (SQL: insert into
model_has_roles(
model_id,
model_type,
role_id,
team_id) values (1000000004, App\Models\User, 1, ?))
i have allready created customer role.
Here is my rolePremission seeder
` // Seeder
public function run()
{
// Reset cached roles and permissions
app()[\Spatie\Permission\PermissionRegistrar::class]->forgetCachedPermissions();
Permission::create(['name' => 'view order']);
Permission::create(['name' => 'edit order']);
Permission::create(['name' => 'delete order']);
Permission::create(['name' => 'create order']);
Permission::create(['name' => 'unpublish order']);
Using -
"laravel/framework": "^9.13",
"spatie/laravel-permission": "^5.5",
Beta Was this translation helpful? Give feedback.
All reactions