laravel-permission icon indicating copy to clipboard operation
laravel-permission copied to clipboard

Base table or view not found: 1146 Table 'role_user' doesn't exist

Open mohitbabel opened this issue 1 year ago • 3 comments

I am using spatie version 5. Whenever I assign new role using this function $user->assignRole('Admin') but I am getting an exception that

Base table or view not found: 1146 Table 'cryo_renewal.role_user' doesn't exist (Connection: mysql, SQL: delete from role_user where role_user.user_id = 1) in spatie laravel problem. What is that error can anyone explain.

mohitbabel avatar Jan 09 '24 07:01 mohitbabel

https://github.com/spatie/laravel-permission/issues/1507#issuecomment-646829549 https://spatie.be/laravel-permission/prerequisites#content-must-not-have-a-role-or-roles-property

parallels999 avatar Jan 09 '24 14:01 parallels999

https://spatie.be/docs/laravel-permission/v6/prerequisites#content-must-not-have-a-role-or-roles-property-nor-a-roles-method

drbyte avatar Jan 10 '24 20:01 drbyte

php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" run this command it should work

SaifullahAkhtar-001 avatar Jan 30 '24 14:01 SaifullahAkhtar-001

Hello everyone!!!. I have problem with laravel permission on migrating , how you can see in the picture spatie-permission I need your help friends

R00TR41Z avatar Apr 05 '24 21:04 R00TR41Z

Hello everyone!!!. I have problem with laravel permission on migrating , how you can see in the picture !

Duplicate of #2650

drbyte avatar Apr 18 '24 21:04 drbyte

Potential FIX:

If you have roles() or permissions() defined inside User remove it. It's conflicting with the HasRoles.

xyznaveen avatar May 03 '24 10:05 xyznaveen