I've used it quite a bit.
Can you show the contents of your tables for roles and model_has_roles?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
I would like to know if anyone has a bit of experience with the package spatie for roles and permissions on laravel 5.5 please.
I have installed all the tables and package, in my web.php file I added these routes:
//ADMIN ROUTES Route::group(['middleware' => ['role:admin']], function () {
Route::get('myaccount', function () { return view('admin/index'); }); //admin folder with index.blade.php created
});
//MANAGER ROUTES Route::group(['middleware' => ['role:manager']], function () {
Route::get('myaccount', function () { return view('manager/index'); }); //manager folder with index.blade.php created
});
When I click on the "myaccount" button, I get this error:
''' Spatie \ Permission \ Exceptions \ UnauthorizedException User does not have the right roles. '''
This particular user has the role_id of "1" which correspond to "admin".
Any idea what I have missed there please?
Thanks
I've used it quite a bit.
Can you show the contents of your tables for roles and model_has_roles?
Please or to participate in this conversation.