PHP code example of webakula / laravel-admin-ext-rbac

1. Go to this page and download the library: Download webakula/laravel-admin-ext-rbac library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

webakula / laravel-admin-ext-rbac example snippets


php artisan migrate

php artisan admin:import rbac

    'route' => [

        'prefix' => env('ADMIN_ROUTE_PREFIX', 'admin'),

        'namespace' => 'App\\Admin\\Controllers',

        'middleware' => ['web', 'admin', 'admin.rbac'],
    ],



// resource资源路由,将自动生成`列表`、`创建`、`编辑`、`更新`等6个路由权限
$router->resource('posts', PostController::class)->rbac('文章管理');

// 将会生成`仪表盘`路由权限
$router->get('dashboard', 'DashboardController@index')->rbac('仪表盘');

// 如果希望多个路由在一个分组下面,可以使用下面的方法
$router->get('system/setting', 'SystemController@index')->rbac('系统', '设置');
$router->post('system/email', 'SystemController@index')->rbac('系统', '发送邮件');



return [
    'actions' => [
        '上传文件' => \App\Admin\Actions\UploadFile::class,
        '全局' => [
            '批量复制' => \App\Admin\Actions\BatchReplicate::class,
            '清理缓存' => \App\Admin\Actions\ClearCache::class,
            '复制'   => \App\Admin\Actions\Replicate::class,
        ],
        '文档'   => [
            '克隆'   => \App\Admin\Actions\Document\CloneDocument::class,
            '批量复制' => \App\Admin\Actions\Document\CopyDocuments::class,
            '导入'   => \App\Admin\Actions\Document\ImportDocument::class,
            '修改权限' => \App\Admin\Actions\Document\ModifyPrivilege::class,
            '分享'   => \App\Admin\Actions\Document\ShareDocument::class,
            '批量分享' => \App\Admin\Actions\Document\ShareDocuments::class,
        ]
    ]
];
shell script
php artisan vendor:publish --provider="Encore\Admin\RBAC\RBACServiceProvider"