Some routes give 403 error #2079
Unanswered
mateferrox
asked this question in
Q&A
Replies: 1 comment 2 replies
-
The guard_name?? |
Beta Was this translation helpful? Give feedback.
2 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.
-
Hello,


I have installed your package, and currently I have a problem with some routes located in the web.php file (for example: "preventivi"):
*web.php
*
If I go to the first route ("preventivi") it returns me the error:
403 | User does not have the right permissions.
it's strange, because in the layout blade file I set it like this:
backend.blade.php
According to your documentation, I have added in the kernel.php file and in Model/User.php:
kernel.php
'permission' => \Spatie\Permission\Middlewares\PermissionMiddleware::class,
User.php
use HasFactory, Notifiable, SoftDeletes, **HasRoles**;
I created the permission and the role through a seeder, always following the documentation:
$pm = Role::create(['name' => 'pm']);
$pm->givePermissionTo('gestione preventivi');
$user3 = User::where(['id' => 3])->first();
$user3->assignRole('pm');
A db has the permission with its role, and I also cleared the cache.
Would you kindly know how to give me a hand?
Beta Was this translation helpful? Give feedback.
All reactions