Mutltitrust (middleware/route)


How setup

Add 3 middlewares app/Http/Kernel.php file

find The application's route middleware. in your kernel file and add this 3 middleware

'role' => \Code4mk\Multitrust\Middleware\VerifyRole::class,
'permission' => \Code4mk\Multitrust\Middleware\VerifyPermission::class,
'level' => \Code4mk\Multitrust\Middleware\VerifyLevel::class,

Use middleware route

$router->get('/example', [
'as' => 'example',
'middleware' => 'role:admin',
'uses' => 'ExampleController@index',
]);
$router->post('/example', [
'as' => 'example',
'middleware' => 'permission:edit.articles',
'uses' => 'ExampleController@index',
]);
$router->get('/example', [
'as' => 'example',
'middleware' => 'level:2', // level >= 2
'uses' => 'ExampleController@index',
]);