Install Role & Permission Controller in Lumen:
composer require spatie/laravel-permission
create a directory named at the root folder -> config
Then copy this file to config directory:
vendor/spatie/laravel-permission/config/permission.php
And copy this file to migration directory:
vendor/spatie/laravel-permission/database/migrations/create_permission_tables.php.stub
at the final change the name of above file to -> 2018_01_01_000000_create_permission_tables.php
Now add this codes to bootstrap/app.php:
$app->routeMiddleware([
'auth' => App\Http\Middleware\Authenticate::class,
'permission' => Spatie\Permission\Middlewares\PermissionMiddleware::class,
'role' => Spatie\Permission\Middlewares\RoleMiddleware::class,
]);
$app->configure('permission');
$app->alias('cache', \Illuminate\Cache\CacheManager::class);
$app->register(Spatie\Permission\PermissionServiceProvider::class);
$app->register(App\Providers\AuthServiceProvider::class);
finally do this command:
php artisan migrate
for basic usage go to this url:
https: