@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | { |
198 | 198 | static::$branchOrder = array_flip(Arr::flatten($order)); |
199 | 199 | |
200 | - static::$branchOrder = array_map(function ($item) { |
|
200 | + static::$branchOrder = array_map(function($item) { |
|
201 | 201 | return ++$item; |
202 | 202 | }, static::$branchOrder); |
203 | 203 | } |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | { |
295 | 295 | parent::boot(); |
296 | 296 | |
297 | - static::saving(function (Model $branch) { |
|
297 | + static::saving(function(Model $branch) { |
|
298 | 298 | $parentColumn = $branch->getParentColumn(); |
299 | 299 | |
300 | 300 | if (Request::has($parentColumn) && Request::input($parentColumn) == $branch->getKey()) { |
@@ -21,20 +21,20 @@ |
||
21 | 21 | public static function environment() |
22 | 22 | { |
23 | 23 | $envs = [ |
24 | - ['name' => 'PHP version', 'value' => 'PHP/'.PHP_VERSION], |
|
25 | - ['name' => 'Laravel version', 'value' => app()->version()], |
|
26 | - ['name' => 'CGI', 'value' => php_sapi_name()], |
|
27 | - ['name' => 'Uname', 'value' => php_uname()], |
|
28 | - ['name' => 'Server', 'value' => Arr::get($_SERVER, 'SERVER_SOFTWARE')], |
|
24 | + ['name' => 'PHP version', 'value' => 'PHP/'.PHP_VERSION], |
|
25 | + ['name' => 'Laravel version', 'value' => app()->version()], |
|
26 | + ['name' => 'CGI', 'value' => php_sapi_name()], |
|
27 | + ['name' => 'Uname', 'value' => php_uname()], |
|
28 | + ['name' => 'Server', 'value' => Arr::get($_SERVER, 'SERVER_SOFTWARE')], |
|
29 | 29 | |
30 | - ['name' => 'Cache driver', 'value' => config('cache.default')], |
|
31 | - ['name' => 'Session driver', 'value' => config('session.driver')], |
|
32 | - ['name' => 'Queue driver', 'value' => config('queue.default')], |
|
30 | + ['name' => 'Cache driver', 'value' => config('cache.default')], |
|
31 | + ['name' => 'Session driver', 'value' => config('session.driver')], |
|
32 | + ['name' => 'Queue driver', 'value' => config('queue.default')], |
|
33 | 33 | |
34 | - ['name' => 'Timezone', 'value' => config('app.timezone')], |
|
35 | - ['name' => 'Locale', 'value' => config('app.locale')], |
|
36 | - ['name' => 'Env', 'value' => config('app.env')], |
|
37 | - ['name' => 'URL', 'value' => config('app.url')], |
|
34 | + ['name' => 'Timezone', 'value' => config('app.timezone')], |
|
35 | + ['name' => 'Locale', 'value' => config('app.locale')], |
|
36 | + ['name' => 'Env', 'value' => config('app.env')], |
|
37 | + ['name' => 'URL', 'value' => config('app.url')], |
|
38 | 38 | ]; |
39 | 39 | |
40 | 40 | return view('admin::dashboard.environment', compact('envs')); |
@@ -65,9 +65,9 @@ |
||
65 | 65 | |
66 | 66 | $prepare = $form->prepare($input); |
67 | 67 | |
68 | - return collect($prepare)->reject(function ($item) { |
|
68 | + return collect($prepare)->reject(function($item) { |
|
69 | 69 | return $item[NestedForm::REMOVE_FLAG_NAME] == 1; |
70 | - })->map(function ($item) { |
|
70 | + })->map(function($item) { |
|
71 | 71 | unset($item[NestedForm::REMOVE_FLAG_NAME]); |
72 | 72 | |
73 | 73 | return $item; |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | * |
437 | 437 | * @param array $data |
438 | 438 | * |
439 | - * @return mixed |
|
439 | + * @return Response|null |
|
440 | 440 | */ |
441 | 441 | protected function prepare($data = []) |
442 | 442 | { |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | /** |
577 | 577 | * Get RedirectResponse after update. |
578 | 578 | * |
579 | - * @param mixed $key |
|
579 | + * @param integer $key |
|
580 | 580 | * |
581 | 581 | * @return \Illuminate\Http\RedirectResponse |
582 | 582 | */ |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | return $ret; |
378 | 378 | } |
379 | 379 | |
380 | - collect(explode(',', $id))->filter()->each(function ($id) { |
|
380 | + collect(explode(',', $id))->filter()->each(function($id) { |
|
381 | 381 | $builder = $this->model()->newQuery(); |
382 | 382 | |
383 | 383 | if ($this->isSoftDeletes) { |
@@ -424,15 +424,15 @@ discard block |
||
424 | 424 | protected function deleteFiles(Model $model, $forceDelete = false) |
425 | 425 | { |
426 | 426 | // If it's a soft delete, the files in the data will not be deleted. |
427 | - if (! $forceDelete && $this->isSoftDeletes) { |
|
427 | + if (!$forceDelete && $this->isSoftDeletes) { |
|
428 | 428 | return; |
429 | 429 | } |
430 | 430 | |
431 | 431 | $data = $model->toArray(); |
432 | 432 | |
433 | - $this->builder->fields()->filter(function ($field) { |
|
433 | + $this->builder->fields()->filter(function($field) { |
|
434 | 434 | return $field instanceof Field\File; |
435 | - })->each(function (Field\File $file) use ($data) { |
|
435 | + })->each(function(Field\File $file) use ($data) { |
|
436 | 436 | $file->setOriginal($data); |
437 | 437 | |
438 | 438 | $file->destroy(); |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | return $response; |
458 | 458 | } |
459 | 459 | |
460 | - DB::transaction(function () { |
|
460 | + DB::transaction(function() { |
|
461 | 461 | $inserts = $this->prepareInsert($this->updates); |
462 | 462 | |
463 | 463 | foreach ($inserts as $column => $value) { |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | */ |
488 | 488 | protected function responseValidationError(MessageBag $message) |
489 | 489 | { |
490 | - if (\request()->ajax() && ! \request()->pjax()) { |
|
490 | + if (\request()->ajax() && !\request()->pjax()) { |
|
491 | 491 | return response()->json([ |
492 | 492 | 'status' => false, |
493 | 493 | 'validation' => $message, |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | $request = Request::capture(); |
511 | 511 | |
512 | 512 | // ajax but not pjax |
513 | - if ($request->ajax() && ! $request->pjax()) { |
|
513 | + if ($request->ajax() && !$request->pjax()) { |
|
514 | 514 | return response()->json([ |
515 | 515 | 'status' => true, |
516 | 516 | 'message' => $message, |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | |
615 | 615 | // Handle validation errors. |
616 | 616 | if ($validationMessages = $this->validationMessages($data)) { |
617 | - if (! $isEditable) { |
|
617 | + if (!$isEditable) { |
|
618 | 618 | return back()->withInput()->withErrors($validationMessages); |
619 | 619 | } |
620 | 620 | |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | return $response; |
626 | 626 | } |
627 | 627 | |
628 | - DB::transaction(function () { |
|
628 | + DB::transaction(function() { |
|
629 | 629 | $updates = $this->prepareUpdate($this->updates); |
630 | 630 | |
631 | 631 | foreach ($updates as $column => $value) { |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | */ |
788 | 788 | protected function handleFileSort(array $input = []): array |
789 | 789 | { |
790 | - if (! array_key_exists(Field::FILE_SORT_FLAG, $input)) { |
|
790 | + if (!array_key_exists(Field::FILE_SORT_FLAG, $input)) { |
|
791 | 791 | return $input; |
792 | 792 | } |
793 | 793 | |
@@ -839,7 +839,7 @@ discard block |
||
839 | 839 | protected function updateRelation($relationsData) |
840 | 840 | { |
841 | 841 | foreach ($relationsData as $name => $values) { |
842 | - if (! method_exists($this->model, $name)) { |
|
842 | + if (!method_exists($this->model, $name)) { |
|
843 | 843 | continue; |
844 | 844 | } |
845 | 845 | |
@@ -898,7 +898,7 @@ discard block |
||
898 | 898 | |
899 | 899 | // When in creating, associate two models |
900 | 900 | $foreignKeyMethod = version_compare(app()->version(), '5.8.0', '<') ? 'getForeignKey' : 'getForeignKeyName'; |
901 | - if (! $this->model->{$relation->{$foreignKeyMethod}()}) { |
|
901 | + if (!$this->model->{$relation->{$foreignKeyMethod}()}) { |
|
902 | 902 | $this->model->{$relation->{$foreignKeyMethod}()} = $parent->getKey(); |
903 | 903 | |
904 | 904 | $this->model->save(); |
@@ -961,7 +961,7 @@ discard block |
||
961 | 961 | $columns = $field->column(); |
962 | 962 | |
963 | 963 | // If column not in input array data, then continue. |
964 | - if (! Arr::has($updates, $columns)) { |
|
964 | + if (!Arr::has($updates, $columns)) { |
|
965 | 965 | continue; |
966 | 966 | } |
967 | 967 | |
@@ -994,8 +994,8 @@ discard block |
||
994 | 994 | protected function isInvalidColumn($columns, $containsDot = false): bool |
995 | 995 | { |
996 | 996 | foreach ((array) $columns as $column) { |
997 | - if ((! $containsDot && Str::contains($column, '.')) || |
|
998 | - ($containsDot && ! Str::contains($column, '.'))) { |
|
997 | + if ((!$containsDot && Str::contains($column, '.')) || |
|
998 | + ($containsDot && !Str::contains($column, '.'))) { |
|
999 | 999 | return true; |
1000 | 1000 | } |
1001 | 1001 | } |
@@ -1045,7 +1045,7 @@ discard block |
||
1045 | 1045 | { |
1046 | 1046 | $first = current($inserts); |
1047 | 1047 | |
1048 | - if (! is_array($first)) { |
|
1048 | + if (!is_array($first)) { |
|
1049 | 1049 | return false; |
1050 | 1050 | } |
1051 | 1051 | |
@@ -1085,7 +1085,7 @@ discard block |
||
1085 | 1085 | if (is_array($columns)) { |
1086 | 1086 | $value = []; |
1087 | 1087 | foreach ($columns as $name => $column) { |
1088 | - if (! Arr::has($data, $column)) { |
|
1088 | + if (!Arr::has($data, $column)) { |
|
1089 | 1089 | continue; |
1090 | 1090 | } |
1091 | 1091 | $value[$name] = Arr::get($data, $column); |
@@ -1105,7 +1105,7 @@ discard block |
||
1105 | 1105 | protected function getFieldByColumn($column) |
1106 | 1106 | { |
1107 | 1107 | return $this->builder->fields()->first( |
1108 | - function (Field $field) use ($column) { |
|
1108 | + function(Field $field) use ($column) { |
|
1109 | 1109 | if (is_array($field->column())) { |
1110 | 1110 | return in_array($column, $field->column()); |
1111 | 1111 | } |
@@ -1124,7 +1124,7 @@ discard block |
||
1124 | 1124 | { |
1125 | 1125 | $values = $this->model->toArray(); |
1126 | 1126 | |
1127 | - $this->builder->fields()->each(function (Field $field) use ($values) { |
|
1127 | + $this->builder->fields()->each(function(Field $field) use ($values) { |
|
1128 | 1128 | $field->setOriginal($values); |
1129 | 1129 | }); |
1130 | 1130 | } |
@@ -1152,8 +1152,8 @@ discard block |
||
1152 | 1152 | |
1153 | 1153 | $data = $this->model->toArray(); |
1154 | 1154 | |
1155 | - $this->builder->fields()->each(function (Field $field) use ($data) { |
|
1156 | - if (! in_array($field->column(), $this->ignored, true)) { |
|
1155 | + $this->builder->fields()->each(function(Field $field) use ($data) { |
|
1156 | + if (!in_array($field->column(), $this->ignored, true)) { |
|
1157 | 1157 | $field->fill($data); |
1158 | 1158 | } |
1159 | 1159 | }); |
@@ -1193,11 +1193,11 @@ discard block |
||
1193 | 1193 | |
1194 | 1194 | /** @var Field $field */ |
1195 | 1195 | foreach ($this->builder->fields() as $field) { |
1196 | - if (! $validator = $field->getValidator($input)) { |
|
1196 | + if (!$validator = $field->getValidator($input)) { |
|
1197 | 1197 | continue; |
1198 | 1198 | } |
1199 | 1199 | |
1200 | - if (($validator instanceof Validator) && ! $validator->passes()) { |
|
1200 | + if (($validator instanceof Validator) && !$validator->passes()) { |
|
1201 | 1201 | $failedValidators[] = $validator; |
1202 | 1202 | } |
1203 | 1203 | } |
@@ -1249,7 +1249,7 @@ discard block |
||
1249 | 1249 | $relations[] = $relation; |
1250 | 1250 | } |
1251 | 1251 | } elseif (method_exists($this->model, $column) && |
1252 | - ! method_exists(Model::class, $column) |
|
1252 | + !method_exists(Model::class, $column) |
|
1253 | 1253 | ) { |
1254 | 1254 | $relations[] = $column; |
1255 | 1255 | } |
@@ -1282,7 +1282,7 @@ discard block |
||
1282 | 1282 | */ |
1283 | 1283 | public function setWidth($fieldWidth = 8, $labelWidth = 2): self |
1284 | 1284 | { |
1285 | - $this->builder()->fields()->each(function ($field) use ($fieldWidth, $labelWidth) { |
|
1285 | + $this->builder()->fields()->each(function($field) use ($fieldWidth, $labelWidth) { |
|
1286 | 1286 | /* @var Field $field */ |
1287 | 1287 | $field->setWidth($fieldWidth, $labelWidth); |
1288 | 1288 | }); |
@@ -1583,7 +1583,7 @@ discard block |
||
1583 | 1583 | */ |
1584 | 1584 | public static function collectFieldAssets(): array |
1585 | 1585 | { |
1586 | - if (! empty(static::$collectedAssets)) { |
|
1586 | + if (!empty(static::$collectedAssets)) { |
|
1587 | 1587 | return static::$collectedAssets; |
1588 | 1588 | } |
1589 | 1589 | |
@@ -1591,7 +1591,7 @@ discard block |
||
1591 | 1591 | $js = collect(); |
1592 | 1592 | |
1593 | 1593 | foreach (static::$availableFields as $field) { |
1594 | - if (! method_exists($field, 'getAssets')) { |
|
1594 | + if (!method_exists($field, 'getAssets')) { |
|
1595 | 1595 | continue; |
1596 | 1596 | } |
1597 | 1597 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | public function up() |
23 | 23 | { |
24 | - Schema::create(config('admin.database.users_table'), function (Blueprint $table) { |
|
24 | + Schema::create(config('admin.database.users_table'), function(Blueprint $table) { |
|
25 | 25 | $table->increments('id'); |
26 | 26 | $table->string('username', 190)->unique(); |
27 | 27 | $table->string('password', 60); |
@@ -31,14 +31,14 @@ discard block |
||
31 | 31 | $table->timestamps(); |
32 | 32 | }); |
33 | 33 | |
34 | - Schema::create(config('admin.database.roles_table'), function (Blueprint $table) { |
|
34 | + Schema::create(config('admin.database.roles_table'), function(Blueprint $table) { |
|
35 | 35 | $table->increments('id'); |
36 | 36 | $table->string('name', 50)->unique(); |
37 | 37 | $table->string('slug', 50)->unique(); |
38 | 38 | $table->timestamps(); |
39 | 39 | }); |
40 | 40 | |
41 | - Schema::create(config('admin.database.permissions_table'), function (Blueprint $table) { |
|
41 | + Schema::create(config('admin.database.permissions_table'), function(Blueprint $table) { |
|
42 | 42 | $table->increments('id'); |
43 | 43 | $table->string('name', 50)->unique(); |
44 | 44 | $table->string('slug', 50)->unique(); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $table->timestamps(); |
48 | 48 | }); |
49 | 49 | |
50 | - Schema::create(config('admin.database.menu_table'), function (Blueprint $table) { |
|
50 | + Schema::create(config('admin.database.menu_table'), function(Blueprint $table) { |
|
51 | 51 | $table->increments('id'); |
52 | 52 | $table->integer('parent_id')->default(0); |
53 | 53 | $table->integer('order')->default(0); |
@@ -59,35 +59,35 @@ discard block |
||
59 | 59 | $table->timestamps(); |
60 | 60 | }); |
61 | 61 | |
62 | - Schema::create(config('admin.database.role_users_table'), function (Blueprint $table) { |
|
62 | + Schema::create(config('admin.database.role_users_table'), function(Blueprint $table) { |
|
63 | 63 | $table->integer('role_id'); |
64 | 64 | $table->integer('user_id'); |
65 | 65 | $table->index(['role_id', 'user_id']); |
66 | 66 | $table->timestamps(); |
67 | 67 | }); |
68 | 68 | |
69 | - Schema::create(config('admin.database.role_permissions_table'), function (Blueprint $table) { |
|
69 | + Schema::create(config('admin.database.role_permissions_table'), function(Blueprint $table) { |
|
70 | 70 | $table->integer('role_id'); |
71 | 71 | $table->integer('permission_id'); |
72 | 72 | $table->index(['role_id', 'permission_id']); |
73 | 73 | $table->timestamps(); |
74 | 74 | }); |
75 | 75 | |
76 | - Schema::create(config('admin.database.user_permissions_table'), function (Blueprint $table) { |
|
76 | + Schema::create(config('admin.database.user_permissions_table'), function(Blueprint $table) { |
|
77 | 77 | $table->integer('user_id'); |
78 | 78 | $table->integer('permission_id'); |
79 | 79 | $table->index(['user_id', 'permission_id']); |
80 | 80 | $table->timestamps(); |
81 | 81 | }); |
82 | 82 | |
83 | - Schema::create(config('admin.database.role_menu_table'), function (Blueprint $table) { |
|
83 | + Schema::create(config('admin.database.role_menu_table'), function(Blueprint $table) { |
|
84 | 84 | $table->integer('role_id'); |
85 | 85 | $table->integer('menu_id'); |
86 | 86 | $table->index(['role_id', 'menu_id']); |
87 | 87 | $table->timestamps(); |
88 | 88 | }); |
89 | 89 | |
90 | - Schema::create(config('admin.database.operation_log_table'), function (Blueprint $table) { |
|
90 | + Schema::create(config('admin.database.operation_log_table'), function(Blueprint $table) { |
|
91 | 91 | $table->increments('id'); |
92 | 92 | $table->integer('user_id'); |
93 | 93 | $table->string('path'); |
@@ -107,6 +107,7 @@ |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
110 | + * @param string $name |
|
110 | 111 | * @return string |
111 | 112 | */ |
112 | 113 | protected function elementNameWithPrefix($name) |
@@ -36,14 +36,14 @@ discard block |
||
36 | 36 | $grid->column('created_at', trans('admin.created_at')); |
37 | 37 | $grid->column('updated_at', trans('admin.updated_at')); |
38 | 38 | |
39 | - $grid->actions(function (Grid\Displayers\Actions $actions) { |
|
39 | + $grid->actions(function(Grid\Displayers\Actions $actions) { |
|
40 | 40 | if ($actions->row->slug == 'administrator') { |
41 | 41 | $actions->disableDelete(); |
42 | 42 | } |
43 | 43 | }); |
44 | 44 | |
45 | - $grid->tools(function (Grid\Tools $tools) { |
|
46 | - $tools->batch(function (Grid\Tools\BatchActions $actions) { |
|
45 | + $grid->tools(function(Grid\Tools $tools) { |
|
46 | + $tools->batch(function(Grid\Tools\BatchActions $actions) { |
|
47 | 47 | $actions->disableDelete(); |
48 | 48 | }); |
49 | 49 | }); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $show->field('id', 'ID'); |
68 | 68 | $show->field('slug', trans('admin.slug')); |
69 | 69 | $show->field('name', trans('admin.name')); |
70 | - $show->field('permissions', trans('admin.permissions'))->as(function ($permission) { |
|
70 | + $show->field('permissions', trans('admin.permissions'))->as(function($permission) { |
|
71 | 71 | return $permission->pluck('name'); |
72 | 72 | })->label(); |
73 | 73 | $show->field('created_at', trans('admin.created_at')); |
@@ -27,14 +27,14 @@ discard block |
||
27 | 27 | |
28 | 28 | $grid->column('id', 'ID')->sortable(); |
29 | 29 | $grid->column('user.name', 'User'); |
30 | - $grid->column('method')->display(function ($method) { |
|
30 | + $grid->column('method')->display(function($method) { |
|
31 | 31 | $color = Arr::get(OperationLog::$methodColors, $method, 'grey'); |
32 | 32 | |
33 | 33 | return "<span class=\"badge bg-$color\">$method</span>"; |
34 | 34 | }); |
35 | 35 | $grid->column('path')->label('info'); |
36 | 36 | $grid->column('ip')->label('primary'); |
37 | - $grid->column('input')->display(function ($input) { |
|
37 | + $grid->column('input')->display(function($input) { |
|
38 | 38 | $input = json_decode($input, true); |
39 | 39 | $input = Arr::except($input, ['_pjax', '_token', '_method', '_previous_']); |
40 | 40 | if (empty($input)) { |
@@ -46,14 +46,14 @@ discard block |
||
46 | 46 | |
47 | 47 | $grid->column('created_at', trans('admin.created_at')); |
48 | 48 | |
49 | - $grid->actions(function (Grid\Displayers\Actions $actions) { |
|
49 | + $grid->actions(function(Grid\Displayers\Actions $actions) { |
|
50 | 50 | $actions->disableEdit(); |
51 | 51 | $actions->disableView(); |
52 | 52 | }); |
53 | 53 | |
54 | 54 | $grid->disableCreateButton(); |
55 | 55 | |
56 | - $grid->filter(function (Grid\Filter $filter) { |
|
56 | + $grid->filter(function(Grid\Filter $filter) { |
|
57 | 57 | $userModel = config('admin.database.users_model'); |
58 | 58 | |
59 | 59 | $filter->equal('user_id', 'User')->select($userModel::all()->pluck('name', 'id')); |
@@ -10,7 +10,7 @@ |
||
10 | 10 | |
11 | 11 | public function render() |
12 | 12 | { |
13 | - $this->options = collect(DateTimeZone::listIdentifiers(DateTimeZone::ALL))->mapWithKeys(function ($timezone) { |
|
13 | + $this->options = collect(DateTimeZone::listIdentifiers(DateTimeZone::ALL))->mapWithKeys(function($timezone) { |
|
14 | 14 | return [$timezone => $timezone]; |
15 | 15 | })->toArray(); |
16 | 16 |