santigarcor/laratrust

Forbidden Admin panel - Middleware not working

Closed this issue · 2 comments

  • Laravel Version: 8.41.0
  • Laratrust Version: 6.3.2

Describe the bug
I have configured middleware option in laratrust panel as
'middleware' => ['role:admin'],

But I always get 403 forbidden error for user assigned as admin.
I even tried a simpler middleware setup as 'auth', I am always redirected to login page, but since the user is already logged in i again get redirected to dashboard. I am not sure what is wrong. I tried almost everything clearing cache, views, config etc.

To Reproduce
Steps to reproduce the behavior:

set middleware option in config/laratrust.php

panel->middleware->'role:admin'

any update on this?

Ok issue is resolved, if anyone else also facing the same issue; please make sure you need to add web + any other middleware you want to use with admin panel.

E.g. in my case it will be

'middleware' => ['web', 'role:admin'],

I think web should be a default for admin panel.