@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | if ($disable) { |
| 86 | 86 | array_delete($this->tools, 'list'); |
| 87 | - } elseif (! in_array('list', $this->tools)) { |
|
| 87 | + } elseif (!in_array('list', $this->tools)) { |
|
| 88 | 88 | array_push($this->tools, 'list'); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | { |
| 101 | 101 | if ($disable) { |
| 102 | 102 | array_delete($this->tools, 'delete'); |
| 103 | - } elseif (! in_array('delete', $this->tools)) { |
|
| 103 | + } elseif (!in_array('delete', $this->tools)) { |
|
| 104 | 104 | array_push($this->tools, 'delete'); |
| 105 | 105 | } |
| 106 | 106 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | { |
| 117 | 117 | if ($disable) { |
| 118 | 118 | array_delete($this->tools, 'view'); |
| 119 | - } elseif (! in_array('view', $this->tools)) { |
|
| 119 | + } elseif (!in_array('view', $this->tools)) { |
|
| 120 | 120 | array_push($this->tools, 'view'); |
| 121 | 121 | } |
| 122 | 122 | |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | return ''; |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | - return $tools->map(function ($tool) { |
|
| 331 | + return $tools->map(function($tool) { |
|
| 332 | 332 | if ($tool instanceof Renderable) { |
| 333 | 333 | return $tool->render(); |
| 334 | 334 | } |
@@ -520,18 +520,18 @@ discard block |
||
| 520 | 520 | */ |
| 521 | 521 | protected function addRequiredAttribute($rules) |
| 522 | 522 | { |
| 523 | - if (! is_array($rules)) { |
|
| 523 | + if (!is_array($rules)) { |
|
| 524 | 524 | return; |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | - if (! in_array('required', $rules, true)) { |
|
| 527 | + if (!in_array('required', $rules, true)) { |
|
| 528 | 528 | return; |
| 529 | 529 | } |
| 530 | 530 | |
| 531 | 531 | $this->setLabelClass(['asterisk']); |
| 532 | 532 | |
| 533 | 533 | // Only text field has `required` attribute. |
| 534 | - if (! $this instanceof Form\Field\Text) { |
|
| 534 | + if (!$this instanceof Form\Field\Text) { |
|
| 535 | 535 | return; |
| 536 | 536 | } |
| 537 | 537 | |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | if ($input instanceof Closure) { |
| 587 | 587 | $rules = $input; |
| 588 | 588 | } else { |
| 589 | - if (! empty($original)) { |
|
| 589 | + if (!empty($original)) { |
|
| 590 | 590 | $original = $this->formatRules($original); |
| 591 | 591 | } |
| 592 | 592 | |
@@ -704,11 +704,11 @@ discard block |
||
| 704 | 704 | $rules = array_filter(explode('|', $rules)); |
| 705 | 705 | } |
| 706 | 706 | |
| 707 | - if (! $this->form) { |
|
| 707 | + if (!$this->form) { |
|
| 708 | 708 | return $rules; |
| 709 | 709 | } |
| 710 | 710 | |
| 711 | - if (! $id = $this->form->model()->getKey()) { |
|
| 711 | + if (!$id = $this->form->model()->getKey()) { |
|
| 712 | 712 | return $rules; |
| 713 | 713 | } |
| 714 | 714 | |
@@ -738,7 +738,7 @@ discard block |
||
| 738 | 738 | return; |
| 739 | 739 | } |
| 740 | 740 | |
| 741 | - if (! is_string($this->rules)) { |
|
| 741 | + if (!is_string($this->rules)) { |
|
| 742 | 742 | return; |
| 743 | 743 | } |
| 744 | 744 | |
@@ -908,12 +908,12 @@ discard block |
||
| 908 | 908 | |
| 909 | 909 | $rules = $attributes = []; |
| 910 | 910 | |
| 911 | - if (! $fieldRules = $this->getRules()) { |
|
| 911 | + if (!$fieldRules = $this->getRules()) { |
|
| 912 | 912 | return false; |
| 913 | 913 | } |
| 914 | 914 | |
| 915 | 915 | if (is_string($this->column)) { |
| 916 | - if (! Arr::has($input, $this->column)) { |
|
| 916 | + if (!Arr::has($input, $this->column)) { |
|
| 917 | 917 | return false; |
| 918 | 918 | } |
| 919 | 919 | |
@@ -925,7 +925,7 @@ discard block |
||
| 925 | 925 | |
| 926 | 926 | if (is_array($this->column)) { |
| 927 | 927 | foreach ($this->column as $key => $column) { |
| 928 | - if (! array_key_exists($column, $input)) { |
|
| 928 | + if (!array_key_exists($column, $input)) { |
|
| 929 | 929 | continue; |
| 930 | 930 | } |
| 931 | 931 | $input[$column.$key] = Arr::get($input, $column); |
@@ -1170,7 +1170,7 @@ discard block |
||
| 1170 | 1170 | */ |
| 1171 | 1171 | public function getElementClass(): array |
| 1172 | 1172 | { |
| 1173 | - if (! $this->elementClass) { |
|
| 1173 | + if (!$this->elementClass) { |
|
| 1174 | 1174 | $name = $this->elementName ?: $this->formatName($this->column); |
| 1175 | 1175 | |
| 1176 | 1176 | $this->elementClass = (array) str_replace(['[', ']'], '_', $name); |
@@ -1373,7 +1373,7 @@ discard block |
||
| 1373 | 1373 | */ |
| 1374 | 1374 | public function getView(): string |
| 1375 | 1375 | { |
| 1376 | - if (! empty($this->view)) { |
|
| 1376 | + if (!empty($this->view)) { |
|
| 1377 | 1377 | return $this->view; |
| 1378 | 1378 | } |
| 1379 | 1379 | |
@@ -1441,7 +1441,7 @@ discard block |
||
| 1441 | 1441 | */ |
| 1442 | 1442 | protected function shouldRender(): bool |
| 1443 | 1443 | { |
| 1444 | - if (! $this->display) { |
|
| 1444 | + if (!$this->display) { |
|
| 1445 | 1445 | return false; |
| 1446 | 1446 | } |
| 1447 | 1447 | |
@@ -1467,7 +1467,7 @@ discard block |
||
| 1467 | 1467 | */ |
| 1468 | 1468 | public function render() |
| 1469 | 1469 | { |
| 1470 | - if (! $this->shouldRender()) { |
|
| 1470 | + if (!$this->shouldRender()) { |
|
| 1471 | 1471 | return ''; |
| 1472 | 1472 | } |
| 1473 | 1473 | |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | $hooks = Arr::get($this->hooks, $name, []); |
| 44 | 44 | |
| 45 | 45 | foreach ($hooks as $func) { |
| 46 | - if (! $func instanceof Closure) { |
|
| 46 | + if (!$func instanceof Closure) { |
|
| 47 | 47 | continue; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $key = $this->model->getKey(); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | - if (! is_null($this->key)) { |
|
| 136 | + if (!is_null($this->key)) { |
|
| 137 | 137 | $key = $this->key; |
| 138 | 138 | } |
| 139 | 139 | |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | $values = $this->original[$key]; |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - $this->fields->each(function (Field $field) use ($values) { |
|
| 244 | + $this->fields->each(function(Field $field) use ($values) { |
|
| 245 | 245 | $field->setOriginal($values); |
| 246 | 246 | }); |
| 247 | 247 | } |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | if (is_array($columns)) { |
| 309 | 309 | $value = []; |
| 310 | 310 | foreach ($columns as $name => $column) { |
| 311 | - if (! Arr::has($data, $column)) { |
|
| 311 | + if (!Arr::has($data, $column)) { |
|
| 312 | 312 | continue; |
| 313 | 313 | } |
| 314 | 314 | $value[$name] = Arr::get($data, $column); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | { |
| 60 | 60 | if ($disable) { |
| 61 | 61 | array_delete($this->buttons, 'reset'); |
| 62 | - } elseif (! in_array('reset', $this->buttons)) { |
|
| 62 | + } elseif (!in_array('reset', $this->buttons)) { |
|
| 63 | 63 | array_push($this->buttons, 'reset'); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | { |
| 76 | 76 | if ($disable) { |
| 77 | 77 | array_delete($this->buttons, 'submit'); |
| 78 | - } elseif (! in_array('submit', $this->buttons)) { |
|
| 78 | + } elseif (!in_array('submit', $this->buttons)) { |
|
| 79 | 79 | array_push($this->buttons, 'submit'); |
| 80 | 80 | } |
| 81 | 81 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | { |
| 92 | 92 | if ($disable) { |
| 93 | 93 | array_delete($this->checkboxes, 'view'); |
| 94 | - } elseif (! in_array('view', $this->checkboxes)) { |
|
| 94 | + } elseif (!in_array('view', $this->checkboxes)) { |
|
| 95 | 95 | array_push($this->checkboxes, 'view'); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | { |
| 108 | 108 | if ($disable) { |
| 109 | 109 | array_delete($this->checkboxes, 'continue_editing'); |
| 110 | - } elseif (! in_array('continue_editing', $this->checkboxes)) { |
|
| 110 | + } elseif (!in_array('continue_editing', $this->checkboxes)) { |
|
| 111 | 111 | array_push($this->checkboxes, 'continue_editing'); |
| 112 | 112 | } |
| 113 | 113 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | { |
| 124 | 124 | if ($disable) { |
| 125 | 125 | array_delete($this->checkboxes, 'continue_creating'); |
| 126 | - } elseif (! in_array('continue_creating', $this->checkboxes)) { |
|
| 126 | + } elseif (!in_array('continue_creating', $this->checkboxes)) { |
|
| 127 | 127 | array_push($this->checkboxes, 'continue_creating'); |
| 128 | 128 | } |
| 129 | 129 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function cannot(string $permission): bool |
| 52 | 52 | { |
| 53 | - return ! $this->can($permission); |
|
| 53 | + return !$this->can($permission); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | protected static function bootHasPermissions() |
| 114 | 114 | { |
| 115 | - static::deleting(function ($model) { |
|
| 115 | + static::deleting(function($model) { |
|
| 116 | 116 | $model->roles()->detach(); |
| 117 | 117 | |
| 118 | 118 | $model->permissions()->detach(); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | $method = $this->http_method; |
| 71 | 71 | |
| 72 | - $matches = array_map(function ($path) use ($method) { |
|
| 72 | + $matches = array_map(function($path) use ($method) { |
|
| 73 | 73 | $path = trim(config('admin.route.prefix'), '/').$path; |
| 74 | 74 | |
| 75 | 75 | if (Str::contains($path, ':')) { |
@@ -117,11 +117,11 @@ discard block |
||
| 117 | 117 | $path = trim($match['path'], '/'); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if (! $request->is($path)) { |
|
| 120 | + if (!$request->is($path)) { |
|
| 121 | 121 | return false; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - $method = collect($match['method'])->filter()->map(function ($method) { |
|
| 124 | + $method = collect($match['method'])->filter()->map(function($method) { |
|
| 125 | 125 | return strtoupper($method); |
| 126 | 126 | }); |
| 127 | 127 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | { |
| 162 | 162 | parent::boot(); |
| 163 | 163 | |
| 164 | - static::deleting(function ($model) { |
|
| 164 | + static::deleting(function($model) { |
|
| 165 | 165 | $model->roles()->detach(); |
| 166 | 166 | }); |
| 167 | 167 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function cannot(string $permission): bool |
| 93 | 93 | { |
| 94 | - return ! $this->can($permission); |
|
| 94 | + return !$this->can($permission); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | { |
| 104 | 104 | parent::boot(); |
| 105 | 105 | |
| 106 | - static::deleting(function ($model) { |
|
| 106 | + static::deleting(function($model) { |
|
| 107 | 107 | $model->administrators()->detach(); |
| 108 | 108 | |
| 109 | 109 | $model->permissions()->detach(); |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | if (is_array($permission)) { |
| 24 | - collect($permission)->each(function ($permission) { |
|
| 24 | + collect($permission)->each(function($permission) { |
|
| 25 | 25 | call_user_func([self::class, 'check'], $permission); |
| 26 | 26 | }); |
| 27 | 27 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | return true; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - if (! Admin::user()->inRoles($roles)) { |
|
| 49 | + if (!Admin::user()->inRoles($roles)) { |
|
| 50 | 50 | static::error(); |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | { |
| 87 | 87 | $response = response(Admin::content()->withError(trans('admin.deny'))); |
| 88 | 88 | |
| 89 | - if (! request()->pjax() && request()->ajax()) { |
|
| 89 | + if (!request()->pjax() && request()->ajax()) { |
|
| 90 | 90 | abort(403, trans('admin.deny')); |
| 91 | 91 | } |
| 92 | 92 | |