Dion
Dion

Reputation: 100

Laratrust Middleware Admin Panel

Laratrust is now offering a panel where you can CRUD the roles and permissions. Works like a charm until I use 'permission:access-laratrust'(for example) as middleware in the configuration. For some odd reason it does not work. I dumped Auth::user() but it returns null...?!
I am lost on how this is not working and user returns null. Any ideas?
Thanks in advance!

Upvotes: 1

Views: 1388

Answers (2)

IronP
IronP

Reputation: 1

I also encountered the same problem. I went through xdebug and came to the conclusion that it is necessary to add all the necessary middleware. In my case this works:

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

So, it`s necessary to check all middlewares.

Upvotes: 0

Fabian
Fabian

Reputation: 1

Add the web middleware before the permission check, like so:

'middleware' => ['web', 'permission:access-laratrust'],

This works for me.

Upvotes: 0

Related Questions