0

I'm using entrust for my laravel 5.5 project to provide an ACL system. As I try to use a middleware in my routes to filter access it falls in the following case

Route::group(['middleware' => ['role:admin', 'role:hr']],
            function () {

//other routes which should be checked by permission
});

if admin access routes which are inside of this method I get an exception

 Symfony \ Component \ HttpKernel \ Exception \ HttpException
No message

if I remove the second role access

Route::group(['middleware' => ['role:admin']],
            function () {

//other routes which should be checked by permission
});

than it works, but I need to split this route access on permissions an can be accessed jut by this 2 roles.

What I do wrong in this case?

fefe
  • 8,755
  • 27
  • 104
  • 180

1 Answers1

0

You don't split the role checks into separate array entries.

It is possible to use pipe symbol as OR operator:

'middleware' => ['role:admin|root']

To emulate AND functionality just use multiple instances of middleware

'middleware' => ['role:owner', 'role:writer']

Docs

Community
  • 1
  • 1