laravel-learn-bbs/config/administrator/permissions.php

72 lines
1.6 KiB
PHP
Raw Normal View History

2018-06-02 08:28:28 +00:00
<?php
/**
* Created by PhpStorm.
* User: xing
* Date: 2018/6/2
* Time: 16:17
*/
use Spatie\Permission\Models\Permission;
return [
'title' => '权限',
'single' => '权限',
'model' => Permission::class,
'permission' => function () {
return Auth::user()->can('manage_users');
},
// 对 CRUD 动作的单独权限控制,通过返回布尔值来控制权限。
'action_permissions' => [
// 控制『新建按钮』的显示
'create' => function ($model) {
return true;
},
// 允许更新
'update' => function ($model) {
return true;
},
// 不允许删除
'delete' => function ($model) {
return false;
},
// 允许查看
'view' => function ($model) {
return true;
},
],
'columns' => [
'id' => [
'title' => 'ID',
],
'name' => [
'title' => '标示',
],
'operation' => [
'title' => '管理',
'sortable' => false,
],
],
'edit_fields' => [
'name' => [
'title' => '标示(请慎重修改)',
// 表单条目标题旁的『提示信息』
'hint' => '修改权限标识会影响代码的调用,请不要轻易更改。'
],
'roles' => [
'type' => 'relationship',
'title' => '角色',
'name_field' => 'name',
],
],
'filters' => [
'name' => [
'title' => '标示',
],
],
];