1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use Illuminate\Database\Seeder; |
4
|
|
|
use PhpCollective\MenuMaker\Storage\Menu; |
5
|
|
|
|
6
|
|
|
class PcmmPermissionsTableSeeder extends Seeder |
7
|
|
|
{ |
8
|
|
|
/** |
9
|
|
|
* Run the database seeds. |
10
|
|
|
* |
11
|
|
|
* @return void |
12
|
|
|
*/ |
13
|
|
|
public function run() |
14
|
|
|
{ |
15
|
|
|
$this->data()->each( |
16
|
|
|
function ($permissions, $key) { |
17
|
|
|
$menu = Menu::firstWhere('alias', $key); |
18
|
|
|
if ($menu) { |
19
|
|
|
$permissions->each( |
20
|
|
|
function ($permission) use ($menu) { |
21
|
|
|
$menu->permissions()->firstOrCreate($permission); |
22
|
|
|
} |
23
|
|
|
); |
24
|
|
|
} else { |
25
|
|
|
echo 'No Menu Is Found with alias="' . $key . '"'; |
26
|
|
|
} |
27
|
|
|
} |
28
|
|
|
); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Supply data for seeding |
33
|
|
|
* |
34
|
|
|
* @return Collection |
|
|
|
|
35
|
|
|
*/ |
36
|
|
|
private function data() |
37
|
|
|
{ |
38
|
|
|
return collect( |
|
|
|
|
39
|
|
|
[ |
40
|
|
|
'pcmm-user-list' => collect( |
41
|
|
|
[ |
42
|
|
|
[ |
43
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
44
|
|
|
'controller' => 'UserController', |
45
|
|
|
'method' => 'GET', |
46
|
|
|
'action' => 'index' |
47
|
|
|
] |
48
|
|
|
] |
49
|
|
|
), |
50
|
|
|
'pcmm-user-group-assign' => collect( |
51
|
|
|
[ |
52
|
|
|
[ |
53
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
54
|
|
|
'controller' => 'UserController', |
55
|
|
|
'method' => 'GET', |
56
|
|
|
'action' => 'edit' |
57
|
|
|
], |
58
|
|
|
[ |
59
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
60
|
|
|
'controller' => 'UserController', |
61
|
|
|
'method' => 'PATCH', |
62
|
|
|
'action' => 'update' |
63
|
|
|
] |
64
|
|
|
] |
65
|
|
|
), |
66
|
|
|
'pcmm-role-list' => collect( |
67
|
|
|
[ |
68
|
|
|
[ |
69
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
70
|
|
|
'controller' => 'RoleController', |
71
|
|
|
'method' => 'GET', |
72
|
|
|
'action' => 'index' |
73
|
|
|
] |
74
|
|
|
] |
75
|
|
|
), |
76
|
|
|
'pcmm-role-create' => collect( |
77
|
|
|
[ |
78
|
|
|
[ |
79
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
80
|
|
|
'controller' => 'RoleController', |
81
|
|
|
'method' => 'GET', |
82
|
|
|
'action' => 'create' |
83
|
|
|
], |
84
|
|
|
[ |
85
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
86
|
|
|
'controller' => 'RoleController', |
87
|
|
|
'method' => 'POST', |
88
|
|
|
'action' => 'store' |
89
|
|
|
] |
90
|
|
|
] |
91
|
|
|
), |
92
|
|
|
'pcmm-role-show' => collect( |
93
|
|
|
[ |
94
|
|
|
[ |
95
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
96
|
|
|
'controller' => 'RoleController', |
97
|
|
|
'method' => 'GET', |
98
|
|
|
'action' => 'show' |
99
|
|
|
] |
100
|
|
|
] |
101
|
|
|
), |
102
|
|
|
'pcmm-role-edit' => collect( |
103
|
|
|
[ |
104
|
|
|
[ |
105
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
106
|
|
|
'controller' => 'RoleController', |
107
|
|
|
'method' => 'GET', |
108
|
|
|
'action' => 'edit' |
109
|
|
|
], |
110
|
|
|
[ |
111
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
112
|
|
|
'controller' => 'RoleController', |
113
|
|
|
'method' => 'PATCH', |
114
|
|
|
'action' => 'update' |
115
|
|
|
] |
116
|
|
|
] |
117
|
|
|
), |
118
|
|
|
'pcmm-role-delete' => collect( |
119
|
|
|
[ |
120
|
|
|
[ |
121
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
122
|
|
|
'controller' => 'RoleController', |
123
|
|
|
'method' => 'DELETE', |
124
|
|
|
'action' => 'destroy' |
125
|
|
|
] |
126
|
|
|
] |
127
|
|
|
), |
128
|
|
|
'pcmm-role-menu' => collect( |
129
|
|
|
[ |
130
|
|
|
[ |
131
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
132
|
|
|
'controller' => 'RoleController', |
133
|
|
|
'method' => 'GET', |
134
|
|
|
'action' => 'menus' |
135
|
|
|
], |
136
|
|
|
[ |
137
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
138
|
|
|
'controller' => 'RoleController', |
139
|
|
|
'method' => 'PUT', |
140
|
|
|
'action' => 'assign' |
141
|
|
|
], |
142
|
|
|
[ |
143
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
144
|
|
|
'controller' => 'MenuController', |
145
|
|
|
'method' => 'GET', |
146
|
|
|
'action' => 'tree' |
147
|
|
|
], |
148
|
|
|
[ |
149
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
150
|
|
|
'controller' => 'MenuController', |
151
|
|
|
'method' => 'GET', |
152
|
|
|
'action' => 'selected' |
153
|
|
|
] |
154
|
|
|
] |
155
|
|
|
), |
156
|
|
|
'pcmm-section-list' => collect( |
157
|
|
|
[ |
158
|
|
|
[ |
159
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
160
|
|
|
'controller' => 'SectionController', |
161
|
|
|
'method' => 'GET', |
162
|
|
|
'action' => 'index' |
163
|
|
|
] |
164
|
|
|
] |
165
|
|
|
), |
166
|
|
|
'pcmm-section-create' => collect( |
167
|
|
|
[ |
168
|
|
|
[ |
169
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
170
|
|
|
'controller' => 'SectionController', |
171
|
|
|
'method' => 'GET', |
172
|
|
|
'action' => 'create' |
173
|
|
|
], |
174
|
|
|
[ |
175
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
176
|
|
|
'controller' => 'SectionController', |
177
|
|
|
'method' => 'POST', |
178
|
|
|
'action' => 'store' |
179
|
|
|
] |
180
|
|
|
] |
181
|
|
|
), |
182
|
|
|
'pcmm-section-show' => collect( |
183
|
|
|
[ |
184
|
|
|
[ |
185
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
186
|
|
|
'controller' => 'SectionController', |
187
|
|
|
'method' => 'GET', |
188
|
|
|
'action' => 'show' |
189
|
|
|
] |
190
|
|
|
] |
191
|
|
|
), |
192
|
|
|
'pcmm-section-edit' => collect( |
193
|
|
|
[ |
194
|
|
|
[ |
195
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
196
|
|
|
'controller' => 'SectionController', |
197
|
|
|
'method' => 'GET', |
198
|
|
|
'action' => 'edit' |
199
|
|
|
], |
200
|
|
|
[ |
201
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
202
|
|
|
'controller' => 'SectionController', |
203
|
|
|
'method' => 'PATCH', |
204
|
|
|
'action' => 'update' |
205
|
|
|
] |
206
|
|
|
] |
207
|
|
|
), |
208
|
|
|
'pcmm-section-delete' => collect( |
209
|
|
|
[ |
210
|
|
|
[ |
211
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
212
|
|
|
'controller' => 'SectionController', |
213
|
|
|
'method' => 'DELETE', |
214
|
|
|
'action' => 'destroy' |
215
|
|
|
] |
216
|
|
|
] |
217
|
|
|
), |
218
|
|
|
'pcmm-menu-list' => collect( |
219
|
|
|
[ |
220
|
|
|
[ |
221
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
222
|
|
|
'controller' => 'MenuController', |
223
|
|
|
'method' => 'GET', |
224
|
|
|
'action' => 'index' |
225
|
|
|
] |
226
|
|
|
] |
227
|
|
|
), |
228
|
|
|
'pcmm-menu-create' => collect( |
229
|
|
|
[ |
230
|
|
|
[ |
231
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
232
|
|
|
'controller' => 'MenuController', |
233
|
|
|
'method' => 'GET', |
234
|
|
|
'action' => 'create' |
235
|
|
|
], |
236
|
|
|
[ |
237
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
238
|
|
|
'controller' => 'MenuController', |
239
|
|
|
'method' => 'GET', |
240
|
|
|
'action' => 'filter' |
241
|
|
|
], |
242
|
|
|
[ |
243
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
244
|
|
|
'controller' => 'MenuController', |
245
|
|
|
'method' => 'POST', |
246
|
|
|
'action' => 'store' |
247
|
|
|
] |
248
|
|
|
] |
249
|
|
|
), |
250
|
|
|
'pcmm-menu-show' => collect( |
251
|
|
|
[ |
252
|
|
|
[ |
253
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
254
|
|
|
'controller' => 'MenuController', |
255
|
|
|
'method' => 'GET', |
256
|
|
|
'action' => 'show' |
257
|
|
|
] |
258
|
|
|
] |
259
|
|
|
), |
260
|
|
|
'pcmm-menu-edit' => collect( |
261
|
|
|
[ |
262
|
|
|
[ |
263
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
264
|
|
|
'controller' => 'MenuController', |
265
|
|
|
'method' => 'GET', |
266
|
|
|
'action' => 'edit' |
267
|
|
|
], |
268
|
|
|
[ |
269
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
270
|
|
|
'controller' => 'MenuController', |
271
|
|
|
'method' => 'GET', |
272
|
|
|
'action' => 'filter' |
273
|
|
|
], |
274
|
|
|
[ |
275
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
276
|
|
|
'controller' => 'MenuController', |
277
|
|
|
'method' => 'PATCH', |
278
|
|
|
'action' => 'update' |
279
|
|
|
] |
280
|
|
|
] |
281
|
|
|
), |
282
|
|
|
'pcmm-menu-delete' => collect( |
283
|
|
|
[ |
284
|
|
|
[ |
285
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
286
|
|
|
'controller' => 'MenuController', |
287
|
|
|
'method' => 'DELETE', |
288
|
|
|
'action' => 'destroy' |
289
|
|
|
] |
290
|
|
|
] |
291
|
|
|
), |
292
|
|
|
'pcmm-permissions' => collect( |
293
|
|
|
[ |
294
|
|
|
[ |
295
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
296
|
|
|
'controller' => 'PermissionController', |
297
|
|
|
'method' => 'GET', |
298
|
|
|
'action' => 'index' |
299
|
|
|
], |
300
|
|
|
[ |
301
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
302
|
|
|
'controller' => 'PermissionController', |
303
|
|
|
'method' => 'GET', |
304
|
|
|
'action' => 'selected' |
305
|
|
|
], |
306
|
|
|
[ |
307
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
308
|
|
|
'controller' => 'MenuController', |
309
|
|
|
'method' => 'GET', |
310
|
|
|
'action' => 'filter' |
311
|
|
|
], |
312
|
|
|
[ |
313
|
|
|
'namespace' => 'PhpCollective\MenuMaker\Http\Controllers', |
314
|
|
|
'controller' => 'PermissionController', |
315
|
|
|
'method' => 'PUT', |
316
|
|
|
'action' => 'update' |
317
|
|
|
] |
318
|
|
|
] |
319
|
|
|
), |
320
|
|
|
] |
321
|
|
|
); |
322
|
|
|
} |
323
|
|
|
} |
324
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths