@@ -40,20 +40,20 @@ discard block |
||
| 40 | 40 | */ |
| 41 | 41 | protected function resolveForm(Request $request) |
| 42 | 42 | { |
| 43 | - if (! $request->has('_form_')) { |
|
| 43 | + if (!$request->has('_form_')) { |
|
| 44 | 44 | throw new Exception('Invalid form request.'); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | $formClass = $request->get('_form_'); |
| 48 | 48 | |
| 49 | - if (! class_exists($formClass)) { |
|
| 49 | + if (!class_exists($formClass)) { |
|
| 50 | 50 | throw new Exception("Form [{$formClass}] does not exist."); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | /** @var Form $form */ |
| 54 | 54 | $form = app($formClass); |
| 55 | 55 | |
| 56 | - if (! method_exists($form, 'handle')) { |
|
| 56 | + if (!method_exists($form, 'handle')) { |
|
| 57 | 57 | throw new Exception("Form method {$formClass}::handle() does not exist."); |
| 58 | 58 | } |
| 59 | 59 | |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | $arguments[] = $model; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if (! $action->passesAuthorization($model)) { |
|
| 80 | + if (!$action->passesAuthorization($model)) { |
|
| 81 | 81 | return $action->failedAuthorization(); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -107,20 +107,20 @@ discard block |
||
| 107 | 107 | */ |
| 108 | 108 | protected function resolveActionInstance(Request $request) |
| 109 | 109 | { |
| 110 | - if (! $request->has('_action')) { |
|
| 110 | + if (!$request->has('_action')) { |
|
| 111 | 111 | throw new Exception('Invalid action request.'); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | $actionClass = str_replace('_', '\\', $request->get('_action')); |
| 115 | 115 | |
| 116 | - if (! class_exists($actionClass)) { |
|
| 116 | + if (!class_exists($actionClass)) { |
|
| 117 | 117 | throw new Exception("Form [{$actionClass}] does not exist."); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | /** @var GridAction $form */ |
| 121 | 121 | $action = app($actionClass); |
| 122 | 122 | |
| 123 | - if (! method_exists($action, 'handle')) { |
|
| 123 | + if (!method_exists($action, 'handle')) { |
|
| 124 | 124 | throw new Exception("Action method {$actionClass}::handle() does not exist."); |
| 125 | 125 | } |
| 126 | 126 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | { |
| 138 | 138 | $args = [$request]; |
| 139 | 139 | |
| 140 | - if (! empty($model)) { |
|
| 140 | + if (!empty($model)) { |
|
| 141 | 141 | array_unshift($args, $model); |
| 142 | 142 | } |
| 143 | 143 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | public function fields(array $fields = []) |
| 189 | 189 | { |
| 190 | - if (! Arr::isAssoc($fields)) { |
|
| 190 | + if (!Arr::isAssoc($fields)) { |
|
| 191 | 191 | $fields = array_combine($fields, $fields); |
| 192 | 192 | } |
| 193 | 193 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | $this->overwriteExistingField($name); |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - return tap($field, function ($field) { |
|
| 249 | + return tap($field, function($field) { |
|
| 250 | 250 | $this->fields->push($field); |
| 251 | 251 | }); |
| 252 | 252 | } |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | $this->overwriteExistingRelation($name); |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | - return tap($relation, function ($relation) { |
|
| 273 | + return tap($relation, function($relation) { |
|
| 274 | 274 | $this->relations->push($relation); |
| 275 | 275 | }); |
| 276 | 276 | } |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | $this->fields = $this->fields->filter( |
| 290 | - function (Field $field) use ($name) { |
|
| 290 | + function(Field $field) use ($name) { |
|
| 291 | 291 | return $field->getName() != $name; |
| 292 | 292 | } |
| 293 | 293 | ); |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | $this->relations = $this->relations->filter( |
| 308 | - function (Relation $relation) use ($name) { |
|
| 308 | + function(Relation $relation) use ($name) { |
|
| 309 | 309 | return $relation->getName() != $name; |
| 310 | 310 | } |
| 311 | 311 | ); |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | */ |
| 363 | 363 | public function setWidth($fieldWidth = 8, $labelWidth = 2) |
| 364 | 364 | { |
| 365 | - collect($this->fields)->each(function ($field) use ($fieldWidth, $labelWidth) { |
|
| 365 | + collect($this->fields)->each(function($field) use ($fieldWidth, $labelWidth) { |
|
| 366 | 366 | $field->each->setWidth($fieldWidth, $labelWidth); |
| 367 | 367 | }); |
| 368 | 368 | |
@@ -447,11 +447,11 @@ discard block |
||
| 447 | 447 | */ |
| 448 | 448 | protected function handleRelationField($method, $arguments) |
| 449 | 449 | { |
| 450 | - if (! method_exists($this->model, $method)) { |
|
| 450 | + if (!method_exists($this->model, $method)) { |
|
| 451 | 451 | return false; |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - if (! ($relation = $this->model->$method()) instanceof EloquentRelation) { |
|
| 454 | + if (!($relation = $this->model->$method()) instanceof EloquentRelation) { |
|
| 455 | 455 | return false; |
| 456 | 456 | } |
| 457 | 457 | |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | use Illuminate\Support\MessageBag; |
| 4 | 4 | |
| 5 | -if (! function_exists('admin_path')) { |
|
| 5 | +if (!function_exists('admin_path')) { |
|
| 6 | 6 | |
| 7 | 7 | /** |
| 8 | 8 | * Get admin path. |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -if (! function_exists('admin_url')) { |
|
| 20 | +if (!function_exists('admin_url')) { |
|
| 21 | 21 | /** |
| 22 | 22 | * Get admin url. |
| 23 | 23 | * |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | -if (! function_exists('admin_base_path')) { |
|
| 42 | +if (!function_exists('admin_base_path')) { |
|
| 43 | 43 | /** |
| 44 | 44 | * Get admin url. |
| 45 | 45 | * |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | -if (! function_exists('admin_toastr')) { |
|
| 66 | +if (!function_exists('admin_toastr')) { |
|
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * Flash a toastr message bag to session. |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | -if (! function_exists('admin_success')) { |
|
| 83 | +if (!function_exists('admin_success')) { |
|
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | 86 | * Flash a success message bag to session. |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | -if (! function_exists('admin_error')) { |
|
| 97 | +if (!function_exists('admin_error')) { |
|
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | 100 | * Flash a error message bag to session. |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | -if (! function_exists('admin_warning')) { |
|
| 111 | +if (!function_exists('admin_warning')) { |
|
| 112 | 112 | |
| 113 | 113 | /** |
| 114 | 114 | * Flash a warning message bag to session. |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | -if (! function_exists('admin_info')) { |
|
| 125 | +if (!function_exists('admin_info')) { |
|
| 126 | 126 | |
| 127 | 127 | /** |
| 128 | 128 | * Flash a message bag to session. |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | -if (! function_exists('admin_asset')) { |
|
| 142 | +if (!function_exists('admin_asset')) { |
|
| 143 | 143 | |
| 144 | 144 | /** |
| 145 | 145 | * @param $path |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | -if (! function_exists('admin_trans')) { |
|
| 155 | +if (!function_exists('admin_trans')) { |
|
| 156 | 156 | |
| 157 | 157 | /** |
| 158 | 158 | * Translate the given message. |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | { |
| 168 | 168 | $line = __($key, $replace, $locale); |
| 169 | 169 | |
| 170 | - if (! is_string($line)) { |
|
| 170 | + if (!is_string($line)) { |
|
| 171 | 171 | return $key; |
| 172 | 172 | } |
| 173 | 173 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | -if (! function_exists('array_delete')) { |
|
| 178 | +if (!function_exists('array_delete')) { |
|
| 179 | 179 | |
| 180 | 180 | /** |
| 181 | 181 | * Delete from array by value. |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | -if (! function_exists('class_uses_deep')) { |
|
| 196 | +if (!function_exists('class_uses_deep')) { |
|
| 197 | 197 | |
| 198 | 198 | /** |
| 199 | 199 | * To get ALL traits including those used by parent classes and other traits. |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | -if (! function_exists('admin_dump')) { |
|
| 222 | +if (!function_exists('admin_dump')) { |
|
| 223 | 223 | |
| 224 | 224 | /** |
| 225 | 225 | * @param $var |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | -if (! function_exists('file_size')) { |
|
| 243 | +if (!function_exists('file_size')) { |
|
| 244 | 244 | |
| 245 | 245 | /** |
| 246 | 246 | * Convert file size to a human readable format like `100mb`. |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | } |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | -if (! function_exists('prepare_options')) { |
|
| 274 | +if (!function_exists('prepare_options')) { |
|
| 275 | 275 | |
| 276 | 276 | /** |
| 277 | 277 | * @param array $options |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | } |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | -if (! function_exists('json_encode_options')) { |
|
| 303 | +if (!function_exists('json_encode_options')) { |
|
| 304 | 304 | |
| 305 | 305 | /** |
| 306 | 306 | * @param array $options |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | */ |
| 236 | 236 | protected function handleExportRequest($forceExport = false) |
| 237 | 237 | { |
| 238 | - if (! $scope = request(Exporter::$queryName)) { |
|
| 238 | + if (!$scope = request(Exporter::$queryName)) { |
|
| 239 | 239 | return; |
| 240 | 240 | } |
| 241 | 241 | |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | $column = new Column($column, $label); |
| 361 | 361 | $column->setGrid($this); |
| 362 | 362 | |
| 363 | - return tap($column, function ($value) { |
|
| 363 | + return tap($column, function($value) { |
|
| 364 | 364 | $this->columns->push($value); |
| 365 | 365 | }); |
| 366 | 366 | } |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | |
| 380 | 380 | $model = $this->model()->eloquent(); |
| 381 | 381 | |
| 382 | - if (! method_exists($model, $relation) || ! $model->{$relation}() instanceof Relations\Relation) { |
|
| 382 | + if (!method_exists($model, $relation) || !$model->{$relation}() instanceof Relations\Relation) { |
|
| 383 | 383 | $class = get_class($model); |
| 384 | 384 | |
| 385 | 385 | admin_error("Call to undefined relationship [{$relation}] on model [{$class}]."); |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | $column = new Column($column, $label); |
| 425 | 425 | $column->setGrid($this); |
| 426 | 426 | |
| 427 | - return tap($column, function ($value) { |
|
| 427 | + return tap($column, function($value) { |
|
| 428 | 428 | $this->columns->prepend($value); |
| 429 | 429 | }); |
| 430 | 430 | } |
@@ -470,9 +470,9 @@ discard block |
||
| 470 | 470 | */ |
| 471 | 471 | public function disablePagination(bool $disable = true) |
| 472 | 472 | { |
| 473 | - $this->model->usePaginate(! $disable); |
|
| 473 | + $this->model->usePaginate(!$disable); |
|
| 474 | 474 | |
| 475 | - return $this->option('show_pagination', ! $disable); |
|
| 475 | + return $this->option('show_pagination', !$disable); |
|
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | /** |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | */ |
| 513 | 513 | protected function prependRowSelectorColumn() |
| 514 | 514 | { |
| 515 | - if (! $this->option('show_row_selector')) { |
|
| 515 | + if (!$this->option('show_row_selector')) { |
|
| 516 | 516 | return; |
| 517 | 517 | } |
| 518 | 518 | |
@@ -590,7 +590,7 @@ discard block |
||
| 590 | 590 | |
| 591 | 591 | $data = $collection->toArray(); |
| 592 | 592 | |
| 593 | - $this->columns->map(function (Column $column) use (&$data) { |
|
| 593 | + $this->columns->map(function(Column $column) use (&$data) { |
|
| 594 | 594 | $data = $column->fill($data); |
| 595 | 595 | |
| 596 | 596 | $this->columnNames[] = $column->getName(); |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | */ |
| 611 | 611 | protected function buildRows(array $data) |
| 612 | 612 | { |
| 613 | - $this->rows = collect($data)->map(function ($model, $number) { |
|
| 613 | + $this->rows = collect($data)->map(function($model, $number) { |
|
| 614 | 614 | return new Row($number, $model, $this->keyName); |
| 615 | 615 | }); |
| 616 | 616 | |
@@ -705,7 +705,7 @@ discard block |
||
| 705 | 705 | */ |
| 706 | 706 | public function disableExport(bool $disable = true) |
| 707 | 707 | { |
| 708 | - return $this->option('show_exporter', ! $disable); |
|
| 708 | + return $this->option('show_exporter', !$disable); |
|
| 709 | 709 | } |
| 710 | 710 | |
| 711 | 711 | /** |
@@ -737,7 +737,7 @@ discard block |
||
| 737 | 737 | */ |
| 738 | 738 | public function disableCreateButton(bool $disable = true) |
| 739 | 739 | { |
| 740 | - return $this->option('show_create_btn', ! $disable); |
|
| 740 | + return $this->option('show_create_btn', !$disable); |
|
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | /** |
@@ -747,7 +747,7 @@ discard block |
||
| 747 | 747 | */ |
| 748 | 748 | public function disableDefineEmptyPage(bool $disable = true) |
| 749 | 749 | { |
| 750 | - return $this->option('show_define_empty_page', ! $disable); |
|
| 750 | + return $this->option('show_define_empty_page', !$disable); |
|
| 751 | 751 | } |
| 752 | 752 | |
| 753 | 753 | /** |
@@ -789,13 +789,13 @@ discard block |
||
| 789 | 789 | */ |
| 790 | 790 | public function resource($path = null) |
| 791 | 791 | { |
| 792 | - if (! empty($path)) { |
|
| 792 | + if (!empty($path)) { |
|
| 793 | 793 | $this->resourcePath = $path; |
| 794 | 794 | |
| 795 | 795 | return $this; |
| 796 | 796 | } |
| 797 | 797 | |
| 798 | - if (! empty($this->resourcePath)) { |
|
| 798 | + if (!empty($this->resourcePath)) { |
|
| 799 | 799 | return $this->resourcePath; |
| 800 | 800 | } |
| 801 | 801 | |
@@ -831,11 +831,11 @@ discard block |
||
| 831 | 831 | { |
| 832 | 832 | $model = $this->model()->eloquent(); |
| 833 | 833 | |
| 834 | - if (! method_exists($model, $method)) { |
|
| 834 | + if (!method_exists($model, $method)) { |
|
| 835 | 835 | return false; |
| 836 | 836 | } |
| 837 | 837 | |
| 838 | - if (! ($relation = $model->$method()) instanceof Relations\Relation) { |
|
| 838 | + if (!($relation = $model->$method()) instanceof Relations\Relation) { |
|
| 839 | 839 | return false; |
| 840 | 840 | } |
| 841 | 841 | |
@@ -931,7 +931,7 @@ discard block |
||
| 931 | 931 | */ |
| 932 | 932 | public function setView($view, $variables = []) |
| 933 | 933 | { |
| 934 | - if (! empty($variables)) { |
|
| 934 | + if (!empty($variables)) { |
|
| 935 | 935 | $this->with($variables); |
| 936 | 936 | } |
| 937 | 937 | |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | public function __construct($content = '') |
| 27 | 27 | { |
| 28 | - if (! empty($content)) { |
|
| 28 | + if (!empty($content)) { |
|
| 29 | 29 | $this->column(12, $content); |
| 30 | 30 | } |
| 31 | 31 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public function row($content) |
| 71 | 71 | { |
| 72 | - if (! $content instanceof \Closure) { |
|
| 72 | + if (!$content instanceof \Closure) { |
|
| 73 | 73 | $row = new Row($content); |
| 74 | 74 | } else { |
| 75 | 75 | $row = new Row(); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | protected function startColumn() |
| 113 | 113 | { |
| 114 | 114 | // get class name using width array |
| 115 | - $classnName = collect($this->width)->map(function ($value, $key) { |
|
| 115 | + $classnName = collect($this->width)->map(function($value, $key) { |
|
| 116 | 116 | return "col-$key-$value"; |
| 117 | 117 | })->implode(' '); |
| 118 | 118 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | protected function validateBreadcrumb(array $breadcrumb) |
| 119 | 119 | { |
| 120 | 120 | foreach ($breadcrumb as $item) { |
| 121 | - if (! is_array($item) || ! Arr::has($item, 'text')) { |
|
| 121 | + if (!is_array($item) || !Arr::has($item, 'text')) { |
|
| 122 | 122 | throw new \Exception('Breadcrumb format error!'); |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | */ |
| 279 | 279 | protected function getUserData() |
| 280 | 280 | { |
| 281 | - if (! $user = Admin::user()) { |
|
| 281 | + if (!$user = Admin::user()) { |
|
| 282 | 282 | return []; |
| 283 | 283 | } |
| 284 | 284 | |
@@ -31,13 +31,13 @@ |
||
| 31 | 31 | { |
| 32 | 32 | $extension = $this->argument('extension'); |
| 33 | 33 | |
| 34 | - if (empty($extension) || ! Arr::has(Admin::$extensions, $extension)) { |
|
| 34 | + if (empty($extension) || !Arr::has(Admin::$extensions, $extension)) { |
|
| 35 | 35 | $extension = $this->choice('Please choose a extension to import', array_keys(Admin::$extensions)); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | $className = Arr::get(Admin::$extensions, $extension); |
| 39 | 39 | |
| 40 | - if (! class_exists($className) || ! method_exists($className, 'import')) { |
|
| 40 | + if (!class_exists($className) || !method_exists($className, 'import')) { |
|
| 41 | 41 | $this->error("Invalid Extension [$className]"); |
| 42 | 42 | |
| 43 | 43 | return; |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public function handle() |
| 44 | 44 | { |
| 45 | - if (! class_exists(Minify\Minify::class)) { |
|
| 45 | + if (!class_exists(Minify\Minify::class)) { |
|
| 46 | 46 | $this->error('To use `admin:minify` command, please install [matthiasmullie/minify] first.'); |
| 47 | 47 | |
| 48 | 48 | return; |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | protected function minifyCSS() |
| 95 | 95 | { |
| 96 | 96 | $css = collect(array_merge(Admin::$css, Admin::baseCss())) |
| 97 | - ->unique()->map(function ($css) { |
|
| 97 | + ->unique()->map(function($css) { |
|
| 98 | 98 | if (url()->isValidUrl($css)) { |
| 99 | 99 | $this->assets['css'][] = $css; |
| 100 | 100 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | protected function minifyJS() |
| 125 | 125 | { |
| 126 | 126 | $js = collect(array_merge(Admin::$js, Admin::baseJs())) |
| 127 | - ->unique()->map(function ($js) { |
|
| 127 | + ->unique()->map(function($js) { |
|
| 128 | 128 | if (url()->isValidUrl($js)) { |
| 129 | 129 | $this->assets['js'][] = $js; |
| 130 | 130 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | |
| 154 | 154 | protected function generateManifest() |
| 155 | 155 | { |
| 156 | - $min = collect(Admin::$min)->mapWithKeys(function ($path, $type) { |
|
| 156 | + $min = collect(Admin::$min)->mapWithKeys(function($path, $type) { |
|
| 157 | 157 | return [$type => sprintf('%s?id=%s', $path, md5(uniqid()))]; |
| 158 | 158 | }); |
| 159 | 159 | |