-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathcategories.php
64 lines (60 loc) · 1.52 KB
/
categories.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
use App\Models\Category;
use Illuminate\Support\Facades\Auth;
return [
'title' => '分类',
'single' => '分类',
'model' => Category::class,
// 对 CRUD 动作的单独权限控制,其他动作不指定默认为通过
'action_permissions' => [
// 删除权限控制
'delete' => function () {
// 只有站长才能删除话题分类
return Auth::user()->hasRole('Founder');
},
],
'columns' => [
'id' => [
'title' => 'ID',
],
'name' => [
'title' => '名称',
'sortable' => false,
],
'description' => [
'title' => '描述',
'sortable' => false,
],
'operation' => [
'title' => '管理',
'sortable' => false,
],
],
'edit_fields' => [
'name' => [
'title' => '名称',
],
'description' => [
'title' => '描述',
'type' => 'textarea',
],
],
'filters' => [
'id' => [
'title' => '分类 ID',
],
'name' => [
'title' => '名称',
],
'description' => [
'title' => '描述',
],
],
'rules' => [
'name' => 'required|min:1|unique:categories'
],
'messages' => [
'name.unique' => '分类名在数据库里有重复,请选用其他名称。',
'name.required' => '请确保名字至少一个字符以上',
],
];