@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | return $next($request); |
34 | 34 | } |
35 | 35 | |
36 | - if (!Admin::user()->allPermissions()->first(function ($permission) use ($request) { |
|
36 | + if (!Admin::user()->allPermissions()->first(function($permission) use ($request) { |
|
37 | 37 | return $permission->shouldPassThrough($request); |
38 | 38 | })) { |
39 | 39 | Checker::error(); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function checkRoutePermission(Request $request) |
54 | 54 | { |
55 | - if (!$middleware = collect($request->route()->middleware())->first(function ($middleware) { |
|
55 | + if (!$middleware = collect($request->route()->middleware())->first(function($middleware) { |
|
56 | 56 | return Str::startsWith($middleware, $this->middlewarePrefix); |
57 | 57 | })) { |
58 | 58 | return false; |
@@ -86,7 +86,7 @@ |
||
86 | 86 | { |
87 | 87 | parent::boot(); |
88 | 88 | |
89 | - static::deleting(function ($model) { |
|
89 | + static::deleting(function($model) { |
|
90 | 90 | $model->administrators()->detach(); |
91 | 91 | |
92 | 92 | $model->permissions()->detach(); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | $method = $this->http_method; |
68 | 68 | |
69 | - $matches = array_map(function ($path) use ($method) { |
|
69 | + $matches = array_map(function($path) use ($method) { |
|
70 | 70 | $path = trim(config('admin.route.prefix'), '/').$path; |
71 | 71 | |
72 | 72 | if (Str::contains($path, ':')) { |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | return false; |
101 | 101 | } |
102 | 102 | |
103 | - $method = collect($match['method'])->filter()->map(function ($method) { |
|
103 | + $method = collect($match['method'])->filter()->map(function($method) { |
|
104 | 104 | return strtoupper($method); |
105 | 105 | }); |
106 | 106 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | { |
141 | 141 | parent::boot(); |
142 | 142 | |
143 | - static::deleting(function ($model) { |
|
143 | + static::deleting(function($model) { |
|
144 | 144 | $model->roles()->detach(); |
145 | 145 | }); |
146 | 146 | } |
@@ -155,7 +155,7 @@ |
||
155 | 155 | { |
156 | 156 | parent::boot(); |
157 | 157 | |
158 | - static::deleting(function ($model) { |
|
158 | + static::deleting(function($model) { |
|
159 | 159 | $model->roles()->detach(); |
160 | 160 | |
161 | 161 | $model->permissions()->detach(); |
@@ -78,7 +78,7 @@ |
||
78 | 78 | { |
79 | 79 | static::treeBoot(); |
80 | 80 | |
81 | - static::deleting(function ($model) { |
|
81 | + static::deleting(function($model) { |
|
82 | 82 | $model->roles()->detach(); |
83 | 83 | }); |
84 | 84 | } |
@@ -225,9 +225,9 @@ discard block |
||
225 | 225 | |
226 | 226 | $this->setSort(); |
227 | 227 | |
228 | - $this->queries->reject(function ($query) { |
|
228 | + $this->queries->reject(function($query) { |
|
229 | 229 | return $query['method'] == 'paginate'; |
230 | - })->each(function ($query) { |
|
230 | + })->each(function($query) { |
|
231 | 231 | $this->model = $this->model->{$query['method']}(...$query['arguments']); |
232 | 232 | }); |
233 | 233 | |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | $this->setSort(); |
275 | 275 | $this->setPaginate(); |
276 | 276 | |
277 | - $this->queries->unique()->each(function ($query) { |
|
277 | + $this->queries->unique()->each(function($query) { |
|
278 | 278 | $this->model = call_user_func_array([$this->model, $query['method']], $query['arguments']); |
279 | 279 | }); |
280 | 280 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | { |
319 | 319 | $paginate = $this->findQueryByMethod('paginate'); |
320 | 320 | |
321 | - $this->queries = $this->queries->reject(function ($query) { |
|
321 | + $this->queries = $this->queries->reject(function($query) { |
|
322 | 322 | return $query['method'] == 'paginate'; |
323 | 323 | }); |
324 | 324 | |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | */ |
373 | 373 | protected function findQueryByMethod($method) |
374 | 374 | { |
375 | - return $this->queries->first(function ($query) use ($method) { |
|
375 | + return $this->queries->first(function($query) use ($method) { |
|
376 | 376 | return $query['method'] == $method; |
377 | 377 | }); |
378 | 378 | } |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | { |
417 | 417 | list($relationName, $relationColumn) = explode('.', $column); |
418 | 418 | |
419 | - if ($this->queries->contains(function ($query) use ($relationName) { |
|
419 | + if ($this->queries->contains(function($query) use ($relationName) { |
|
420 | 420 | return $query['method'] == 'with' && in_array($relationName, $query['arguments']); |
421 | 421 | })) { |
422 | 422 | $relation = $this->model->$relationName(); |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | */ |
446 | 446 | public function resetOrderBy() |
447 | 447 | { |
448 | - $this->queries = $this->queries->reject(function ($query) { |
|
448 | + $this->queries = $this->queries->reject(function($query) { |
|
449 | 449 | return $query['method'] == 'orderBy' || $query['method'] == 'orderByDesc'; |
450 | 450 | }); |
451 | 451 | } |
@@ -305,9 +305,9 @@ discard block |
||
305 | 305 | $data = $this->model->with($this->getRelations()) |
306 | 306 | ->findOrFail($id)->toArray(); |
307 | 307 | |
308 | - $this->builder->fields()->filter(function ($field) { |
|
308 | + $this->builder->fields()->filter(function($field) { |
|
309 | 309 | return $field instanceof Field\File; |
310 | - })->each(function (File $file) use ($data) { |
|
310 | + })->each(function(File $file) use ($data) { |
|
311 | 311 | $file->setOriginal($data); |
312 | 312 | |
313 | 313 | $file->destroy(); |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | return $response; |
333 | 333 | } |
334 | 334 | |
335 | - DB::transaction(function () { |
|
335 | + DB::transaction(function() { |
|
336 | 336 | $inserts = $this->prepareInsert($this->updates); |
337 | 337 | |
338 | 338 | foreach ($inserts as $column => $value) { |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | return $response; |
534 | 534 | } |
535 | 535 | |
536 | - DB::transaction(function () { |
|
536 | + DB::transaction(function() { |
|
537 | 537 | $updates = $this->prepareUpdate($this->updates); |
538 | 538 | |
539 | 539 | foreach ($updates as $column => $value) { |
@@ -925,7 +925,7 @@ discard block |
||
925 | 925 | protected function getFieldByColumn($column) |
926 | 926 | { |
927 | 927 | return $this->builder->fields()->first( |
928 | - function (Field $field) use ($column) { |
|
928 | + function(Field $field) use ($column) { |
|
929 | 929 | if (is_array($field->column())) { |
930 | 930 | return in_array($column, $field->column()); |
931 | 931 | } |
@@ -946,7 +946,7 @@ discard block |
||
946 | 946 | |
947 | 947 | $values = $this->model->toArray(); |
948 | 948 | |
949 | - $this->builder->fields()->each(function (Field $field) use ($values) { |
|
949 | + $this->builder->fields()->each(function(Field $field) use ($values) { |
|
950 | 950 | $field->setOriginal($values); |
951 | 951 | }); |
952 | 952 | } |
@@ -968,7 +968,7 @@ discard block |
||
968 | 968 | |
969 | 969 | $data = $this->model->toArray(); |
970 | 970 | |
971 | - $this->builder->fields()->each(function (Field $field) use ($data) { |
|
971 | + $this->builder->fields()->each(function(Field $field) use ($data) { |
|
972 | 972 | if (!in_array($field->column(), $this->ignored)) { |
973 | 973 | $field->fill($data); |
974 | 974 | } |
@@ -1089,7 +1089,7 @@ discard block |
||
1089 | 1089 | */ |
1090 | 1090 | public function setWidth($fieldWidth = 8, $labelWidth = 2) |
1091 | 1091 | { |
1092 | - $this->builder()->fields()->each(function ($field) use ($fieldWidth, $labelWidth) { |
|
1092 | + $this->builder()->fields()->each(function($field) use ($fieldWidth, $labelWidth) { |
|
1093 | 1093 | /* @var Field $field */ |
1094 | 1094 | $field->setWidth($fieldWidth, $labelWidth); |
1095 | 1095 | }); |
@@ -80,11 +80,11 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public function getSetting() |
82 | 82 | { |
83 | - return Admin::content(function (Content $content) { |
|
83 | + return Admin::content(function(Content $content) { |
|
84 | 84 | $content->header(trans('admin.user_setting')); |
85 | 85 | $form = $this->settingForm(); |
86 | 86 | $form->tools( |
87 | - function (Form\Tools $tools) { |
|
87 | + function(Form\Tools $tools) { |
|
88 | 88 | $tools->disableBackButton(); |
89 | 89 | $tools->disableListButton(); |
90 | 90 | } |
@@ -110,13 +110,13 @@ discard block |
||
110 | 110 | */ |
111 | 111 | protected function settingForm() |
112 | 112 | { |
113 | - return Administrator::form(function (Form $form) { |
|
113 | + return Administrator::form(function(Form $form) { |
|
114 | 114 | $form->display('username', trans('admin.username')); |
115 | 115 | $form->text('name', trans('admin.name'))->rules('required'); |
116 | 116 | $form->image('avatar', trans('admin.avatar')); |
117 | 117 | $form->password('password', trans('admin.password'))->rules('confirmed|required'); |
118 | 118 | $form->password('password_confirmation', trans('admin.password_confirmation'))->rules('required') |
119 | - ->default(function ($form) { |
|
119 | + ->default(function($form) { |
|
120 | 120 | return $form->model()->password; |
121 | 121 | }); |
122 | 122 | |
@@ -124,13 +124,13 @@ discard block |
||
124 | 124 | |
125 | 125 | $form->ignore(['password_confirmation']); |
126 | 126 | |
127 | - $form->saving(function (Form $form) { |
|
127 | + $form->saving(function(Form $form) { |
|
128 | 128 | if ($form->password && $form->model()->password != $form->password) { |
129 | 129 | $form->password = bcrypt($form->password); |
130 | 130 | } |
131 | 131 | }); |
132 | 132 | |
133 | - $form->saved(function () { |
|
133 | + $form->saved(function() { |
|
134 | 134 | admin_toastr(trans('admin.update_succeeded')); |
135 | 135 | |
136 | 136 | return redirect(admin_url('auth/setting')); |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function index() |
26 | 26 | { |
27 | - return Admin::content(function (Content $content) { |
|
27 | + return Admin::content(function(Content $content) { |
|
28 | 28 | $content->header(trans('admin.menu')); |
29 | 29 | $content->description(trans('admin.list')); |
30 | 30 | |
31 | - $content->row(function (Row $row) { |
|
31 | + $content->row(function(Row $row) { |
|
32 | 32 | $row->column(6, $this->treeView()->render()); |
33 | 33 | |
34 | - $row->column(6, function (Column $column) { |
|
34 | + $row->column(6, function(Column $column) { |
|
35 | 35 | $form = new \Encore\Admin\Widgets\Form(); |
36 | 36 | $form->action(admin_url('auth/menu')); |
37 | 37 | |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | */ |
66 | 66 | protected function treeView() |
67 | 67 | { |
68 | - return Menu::tree(function (Tree $tree) { |
|
68 | + return Menu::tree(function(Tree $tree) { |
|
69 | 69 | $tree->disableCreate(); |
70 | 70 | |
71 | - $tree->branch(function ($branch) { |
|
71 | + $tree->branch(function($branch) { |
|
72 | 72 | $payload = "<i class='fa {$branch['icon']}'></i> <strong>{$branch['title']}</strong>"; |
73 | 73 | |
74 | 74 | if (!isset($branch['children'])) { |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function edit($id) |
97 | 97 | { |
98 | - return Admin::content(function (Content $content) use ($id) { |
|
98 | + return Admin::content(function(Content $content) use ($id) { |
|
99 | 99 | $content->header(trans('admin.menu')); |
100 | 100 | $content->description(trans('admin.edit')); |
101 | 101 | |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function form() |
112 | 112 | { |
113 | - return Menu::form(function (Form $form) { |
|
113 | + return Menu::form(function(Form $form) { |
|
114 | 114 | $form->display('id', 'ID'); |
115 | 115 | |
116 | 116 | $form->select('parent_id', trans('admin.parent_id'))->options(Menu::selectOptions()); |