alexkb/nova-permission
Composer 安装命令:
composer require alexkb/nova-permission
包简介
A Laravel Nova tool for Spatie's Permission library.
README 文档
README
Installation
You can install the package in to a Laravel app that uses Nova via composer:
composer require vyuldashev/nova-permission
Go through the Installation section in order to setup laravel-permission.
Next up, you must register the tool with Nova. This is typically done in the tools method of the NovaServiceProvider.
// in app/Providers/NovaServiceProvider.php // ... public function tools() { return [ // ... \Vyuldashev\NovaPermission\NovaPermissionTool::make(), ]; }
Next, add middleware to config/nova.php
// in config/nova.php 'middleware' => [ // ... \Vyuldashev\NovaPermission\ForgetCachedPermissions::class, ],
Finally, add MorphToMany fields to you app/Nova/User resource:
// ... use Laravel\Nova\Fields\MorphToMany; public function fields(Request $request) { return [ // ... MorphToMany::make('Roles', 'roles', \Vyuldashev\NovaPermission\Role::class), MorphToMany::make('Permissions', 'permissions', \Vyuldashev\NovaPermission\Permission::class), ]; }
Customization
If you want to use custom resource classes you can define them when you register a tool:
// in app/Providers/NovaServiceProvider.php // ... public function tools() { return [ // ... \Vyuldashev\NovaPermission\NovaPermissionTool::make() ->roleResource(CustomRole::class) ->permissionResource(CustomPermission::class), ]; }
Usage
A new menu item called "Permissions & Roles" will appear in your Nova app after installing this package.
统计信息
- 总下载量: 83
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-11-03


