Entrust Laravel 5.3

6

I've been working with Laravel Entrust for several days. It turns out that when I try to validate the roles from the routes, I get the following error:

Class App\Http\Zizaco\Entrust\Middleware\EntrustRole does not exist

Here is my validation from the routes:

Route::group(['prefix' => '/', 'middleware' => ['role:admin']], function(){
 //Mis rutas
});

I have done everything, just like the original documentation and I really do not know where I am wrong or making a bad step.

    
asked by Erain Moya 26.10.2016 в 20:50
source

1 answer

1

The definition of middleware for routes in app\Http\Kernel.php should be according to the documentation:

'role' => \Zizaco\Entrust\Middleware\EntrustRole::class,
'permission' => \Zizaco\Entrust\Middleware\EntrustPermission::class,
'ability' => \Zizaco\Entrust\Middleware\EntrustAbility::class,

If you remove the \ that is at the beginning, you are using a different namespace and the application will not find them.

    
answered by 26.10.2016 / 21:01
source