1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use Illuminate\Database\Seeder; |
4
|
|
|
use PhpCollective\MenuMaker\Storage\Menu; |
5
|
|
|
|
6
|
|
|
class PcmmMenusTableSeeder extends Seeder |
7
|
|
|
{ |
8
|
|
|
/** |
9
|
|
|
* Run the database seeds. |
10
|
|
|
* |
11
|
|
|
* @return void |
12
|
|
|
*/ |
13
|
|
|
public function run() |
14
|
|
|
{ |
15
|
|
|
$this->data()->each(function ($data) { |
16
|
|
|
Menu::create($data); |
17
|
|
|
}); |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Supply data for seeding |
22
|
|
|
* |
23
|
|
|
* @return \Illuminate\Database\Eloquent\Collection |
24
|
|
|
*/ |
25
|
|
|
private function data() |
26
|
|
|
{ |
27
|
|
|
return collect([ |
28
|
|
|
[ |
29
|
|
|
'name' => 'Menu Maker', |
30
|
|
|
'alias' => 'menu-maker', |
31
|
|
|
'children' => [ |
32
|
|
|
[ |
33
|
|
|
'name' => 'Home', |
34
|
|
|
'alias' => 'home', |
35
|
|
|
'routes' => '', |
36
|
|
|
'link' => config('menu.path'), |
37
|
|
|
'icon' => '', |
38
|
|
|
'class' => '', |
39
|
|
|
'privilege' => 'PUBLIC', |
40
|
|
|
], |
41
|
|
|
[ |
42
|
|
|
'name' => 'Users', |
43
|
|
|
'alias' => 'pcmm-users', |
44
|
|
|
'routes' => 'menu-maker::users.index,menu-maker::users.edit', |
45
|
|
|
'link' => config('menu.path') . '/users', |
46
|
|
|
'icon' => '', |
47
|
|
|
'class' => '', |
48
|
|
|
'children' => [ |
49
|
|
|
[ |
50
|
|
|
'name' => 'List', |
51
|
|
|
'alias' => 'pcmm-user-list', |
52
|
|
|
'routes' => 'menu-maker::users.index', |
53
|
|
|
'link' => config('menu.path') . '/users', |
54
|
|
|
'icon' => '', |
55
|
|
|
'class' => '', |
56
|
|
|
'visible' => false |
57
|
|
|
], |
58
|
|
|
[ |
59
|
|
|
'name' => 'Assign Group', |
60
|
|
|
'alias' => 'pcmm-user-group-assign', |
61
|
|
|
'routes' => 'menu-maker::users.edit', |
62
|
|
|
'link' => '', |
63
|
|
|
'icon' => '', |
64
|
|
|
'class' => '', |
65
|
|
|
'visible' => false |
66
|
|
|
] |
67
|
|
|
], |
68
|
|
|
], |
69
|
|
|
[ |
70
|
|
|
'name' => 'Roles', |
71
|
|
|
'alias' => 'pcmm-roles', |
72
|
|
|
'routes' => 'menu-maker::roles.index,menu-maker::roles.create,menu-maker::roles.edit,menu-maker::roles.show', |
73
|
|
|
'link' => config('menu.path') . '/roles', |
74
|
|
|
'icon' => '', |
75
|
|
|
'class' => '', |
76
|
|
|
'children' => [ |
77
|
|
|
[ |
78
|
|
|
'name' => 'List', |
79
|
|
|
'alias' => 'pcmm-role-list', |
80
|
|
|
'routes' => 'menu-maker::roles.index', |
81
|
|
|
'link' => config('menu.path') . '/roles', |
82
|
|
|
'icon' => '', |
83
|
|
|
'class' => '', |
84
|
|
|
'visible' => false |
85
|
|
|
], |
86
|
|
|
[ |
87
|
|
|
'name' => 'Create', |
88
|
|
|
'alias' => 'pcmm-role-create', |
89
|
|
|
'routes' => 'menu-maker::roles.create', |
90
|
|
|
'link' => config('menu.path') . '/role/create', |
91
|
|
|
'icon' => '', |
92
|
|
|
'class' => '', |
93
|
|
|
'visible' => false |
94
|
|
|
], |
95
|
|
|
[ |
96
|
|
|
'name' => 'View', |
97
|
|
|
'alias' => 'pcmm-role-show', |
98
|
|
|
'routes' => 'menu-maker::roles.show', |
99
|
|
|
'link' => '', |
100
|
|
|
'icon' => '', |
101
|
|
|
'class' => '', |
102
|
|
|
'visible' => false |
103
|
|
|
], |
104
|
|
|
[ |
105
|
|
|
'name' => 'Edit', |
106
|
|
|
'alias' => 'pcmm-role-edit', |
107
|
|
|
'routes' => 'menu-maker::roles.edit', |
108
|
|
|
'link' => '', |
109
|
|
|
'icon' => '', |
110
|
|
|
'class' => '', |
111
|
|
|
'visible' => false |
112
|
|
|
], |
113
|
|
|
[ |
114
|
|
|
'name' => 'Delete', |
115
|
|
|
'alias' => 'pcmm-role-delete', |
116
|
|
|
'routes' => 'menu-maker::roles.delete', |
117
|
|
|
'link' => '', |
118
|
|
|
'icon' => '', |
119
|
|
|
'class' => '', |
120
|
|
|
'visible' => false |
121
|
|
|
], |
122
|
|
|
[ |
123
|
|
|
'name' => 'Set Permission', |
124
|
|
|
'alias' => 'pcmm-role-menu', |
125
|
|
|
'routes' => 'menu-maker::roles.menus', |
126
|
|
|
'link' => config('menu.path') . '/roles/menus', |
127
|
|
|
'icon' => '', |
128
|
|
|
'class' => '', |
129
|
|
|
'privilege' => 'PROTECTED', |
130
|
|
|
'visible' => false |
131
|
|
|
] |
132
|
|
|
], |
133
|
|
|
], |
134
|
|
|
[ |
135
|
|
|
'name' => 'Sections', |
136
|
|
|
'alias' => 'pcmm-sections', |
137
|
|
|
'routes' => 'menu-maker::sections.index,menu-maker::sections.create,menu-maker::sections.edit,menu-maker::sections.show', |
138
|
|
|
'link' => config('menu.path') . '/sections', |
139
|
|
|
'icon' => '', |
140
|
|
|
'class' => '', |
141
|
|
|
'children' => [ |
142
|
|
|
[ |
143
|
|
|
'name' => 'List', |
144
|
|
|
'alias' => 'pcmm-section-list', |
145
|
|
|
'routes' => 'menu-maker::sections.index', |
146
|
|
|
'link' => config('menu.path') . '/sections', |
147
|
|
|
'icon' => '', |
148
|
|
|
'class' => '', |
149
|
|
|
'visible' => false |
150
|
|
|
], |
151
|
|
|
[ |
152
|
|
|
'name' => 'Create', |
153
|
|
|
'alias' => 'pcmm-section-create', |
154
|
|
|
'routes' => 'menu-maker::sections.create', |
155
|
|
|
'link' => config('menu.path') . '/section/create', |
156
|
|
|
'icon' => '', |
157
|
|
|
'class' => '', |
158
|
|
|
'visible' => false |
159
|
|
|
], |
160
|
|
|
[ |
161
|
|
|
'name' => 'View', |
162
|
|
|
'alias' => 'pcmm-section-show', |
163
|
|
|
'routes' => 'menu-maker::sections.show', |
164
|
|
|
'link' => '', |
165
|
|
|
'icon' => '', |
166
|
|
|
'class' => '', |
167
|
|
|
'visible' => false |
168
|
|
|
], |
169
|
|
|
[ |
170
|
|
|
'name' => 'Edit', |
171
|
|
|
'alias' => 'pcmm-section-edit', |
172
|
|
|
'routes' => 'menu-maker::sections.edit', |
173
|
|
|
'link' => '', |
174
|
|
|
'icon' => '', |
175
|
|
|
'class' => '', |
176
|
|
|
'visible' => false |
177
|
|
|
], |
178
|
|
|
[ |
179
|
|
|
'name' => 'Delete', |
180
|
|
|
'alias' => 'pcmm-section-delete', |
181
|
|
|
'routes' => 'menu-maker::sections.delete', |
182
|
|
|
'link' => '', |
183
|
|
|
'icon' => '', |
184
|
|
|
'class' => '', |
185
|
|
|
'visible' => false |
186
|
|
|
] |
187
|
|
|
], |
188
|
|
|
], |
189
|
|
|
[ |
190
|
|
|
'name' => 'Menus', |
191
|
|
|
'alias' => 'pcmm-menus', |
192
|
|
|
'routes' => 'menu-maker::menus.index,menu-maker::menus.create,menu-maker::menus.edit,menu-maker::menus.show', |
193
|
|
|
'link' => config('menu.path') . '/menus', |
194
|
|
|
'icon' => '', |
195
|
|
|
'class' => '', |
196
|
|
|
'children' => [ |
197
|
|
|
[ |
198
|
|
|
'name' => 'List', |
199
|
|
|
'alias' => 'pcmm-menu-list', |
200
|
|
|
'routes' => 'menu-maker::menus.index', |
201
|
|
|
'link' => config('menu.path') . '/menus', |
202
|
|
|
'icon' => '', |
203
|
|
|
'class' => '', |
204
|
|
|
'visible' => false |
205
|
|
|
], |
206
|
|
|
[ |
207
|
|
|
'name' => 'Create', |
208
|
|
|
'alias' => 'pcmm-menu-create', |
209
|
|
|
'routes' => 'menu-maker::menus.create', |
210
|
|
|
'link' => config('menu.path') . '/menu/create', |
211
|
|
|
'icon' => '', |
212
|
|
|
'class' => '', |
213
|
|
|
'visible' => false |
214
|
|
|
], |
215
|
|
|
[ |
216
|
|
|
'name' => 'View', |
217
|
|
|
'alias' => 'pcmm-menu-show', |
218
|
|
|
'routes' => 'menu-maker::menus.show', |
219
|
|
|
'link' => '', |
220
|
|
|
'icon' => '', |
221
|
|
|
'class' => '', |
222
|
|
|
'visible' => false |
223
|
|
|
], |
224
|
|
|
[ |
225
|
|
|
'name' => 'Edit', |
226
|
|
|
'alias' => 'pcmm-menu-edit', |
227
|
|
|
'routes' => 'menu-maker::menus.edit', |
228
|
|
|
'link' => '', |
229
|
|
|
'icon' => '', |
230
|
|
|
'class' => '', |
231
|
|
|
'visible' => false |
232
|
|
|
], |
233
|
|
|
[ |
234
|
|
|
'name' => 'Delete', |
235
|
|
|
'alias' => 'pcmm-menu-delete', |
236
|
|
|
'routes' => 'menu-maker::menus.delete', |
237
|
|
|
'link' => '', |
238
|
|
|
'icon' => '', |
239
|
|
|
'class' => '', |
240
|
|
|
'visible' => false |
241
|
|
|
] |
242
|
|
|
], |
243
|
|
|
], |
244
|
|
|
[ |
245
|
|
|
'name' => 'Permissions', |
246
|
|
|
'alias' => 'pcmm-permissions', |
247
|
|
|
'routes' => 'menu-maker::permissions.index', |
248
|
|
|
'link' => config('menu.path') . '/permissions', |
249
|
|
|
'icon' => '', |
250
|
|
|
'class' => '', |
251
|
|
|
'privilege' => 'PRIVATE', |
252
|
|
|
'children' => [ |
253
|
|
|
[ |
254
|
|
|
'name' => 'Set Menu Routes', |
255
|
|
|
'alias' => 'pcmm-permission-list', |
256
|
|
|
'routes' => 'menu-maker::permissions.index', |
257
|
|
|
'link' => config('menu.path') . '/permissions', |
258
|
|
|
'icon' => '', |
259
|
|
|
'class' => '', |
260
|
|
|
'visible' => false |
261
|
|
|
] |
262
|
|
|
], |
263
|
|
|
] |
264
|
|
|
] |
265
|
|
|
] |
266
|
|
|
]); |
267
|
|
|
} |
268
|
|
|
} |
269
|
|
|
|