@@ -55,7 +55,7 @@ |
||
| 55 | 55 | /** |
| 56 | 56 | * Returns builder is $mode. |
| 57 | 57 | * |
| 58 | - * @param $mode |
|
| 58 | + * @param string $mode |
|
| 59 | 59 | * |
| 60 | 60 | * @return bool |
| 61 | 61 | */ |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | */ |
| 337 | 337 | public function field($name) |
| 338 | 338 | { |
| 339 | - return $this->fields()->first(function (Field $field) use ($name) { |
|
| 339 | + return $this->fields()->first(function(Field $field) use ($name) { |
|
| 340 | 340 | return $field->column() === $name; |
| 341 | 341 | }); |
| 342 | 342 | } |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | */ |
| 349 | 349 | public function hasRows(): bool |
| 350 | 350 | { |
| 351 | - return ! empty($this->form->rows); |
|
| 351 | + return !empty($this->form->rows); |
|
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | /** |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | { |
| 460 | 460 | $previous = URL::previous(); |
| 461 | 461 | |
| 462 | - if (! $previous || $previous === URL::current()) { |
|
| 462 | + if (!$previous || $previous === URL::current()) { |
|
| 463 | 463 | return; |
| 464 | 464 | } |
| 465 | 465 | |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | */ |
| 524 | 524 | protected function removeReservedFields() |
| 525 | 525 | { |
| 526 | - if (! $this->isCreating()) { |
|
| 526 | + if (!$this->isCreating()) { |
|
| 527 | 527 | return; |
| 528 | 528 | } |
| 529 | 529 | |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | |
| 536 | 536 | $this->form->getLayout()->removeReservedFields($reservedColumns); |
| 537 | 537 | |
| 538 | - $this->fields = $this->fields()->reject(function (Field $field) use ($reservedColumns) { |
|
| 538 | + $this->fields = $this->fields()->reject(function(Field $field) use ($reservedColumns) { |
|
| 539 | 539 | return in_array($field->column(), $reservedColumns, true); |
| 540 | 540 | }); |
| 541 | 541 | } |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | |
| 572 | 572 | $tabObj = $this->form->setTab(); |
| 573 | 573 | |
| 574 | - if (! $tabObj->isEmpty()) { |
|
| 574 | + if (!$tabObj->isEmpty()) { |
|
| 575 | 575 | $script = <<<'SCRIPT' |
| 576 | 576 | |
| 577 | 577 | var hash = document.location.hash; |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | return $this->style([$styles]); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - $styles = array_map(function ($style) { |
|
| 67 | + $styles = array_map(function($style) { |
|
| 68 | 68 | return 'box-'.$style; |
| 69 | 69 | }, $styles); |
| 70 | 70 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * |
| 13 | 13 | * @param $permission |
| 14 | 14 | * |
| 15 | - * @return true |
|
| 15 | + * @return boolean|null |
|
| 16 | 16 | */ |
| 17 | 17 | public static function check($permission) |
| 18 | 18 | { |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @param $roles |
| 32 | 32 | * |
| 33 | - * @return true |
|
| 33 | + * @return boolean|null |
|
| 34 | 34 | */ |
| 35 | 35 | public static function allow($roles) |
| 36 | 36 | { |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | * |
| 49 | 49 | * @param $roles |
| 50 | 50 | * |
| 51 | - * @return true |
|
| 51 | + * @return boolean|null |
|
| 52 | 52 | */ |
| 53 | 53 | public static function deny($roles) |
| 54 | 54 | { |
@@ -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 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | /** |
| 241 | 241 | * Resolve perPage for pagination. |
| 242 | 242 | * |
| 243 | - * @param array|null $paginate |
|
| 243 | + * @param Model $paginate |
|
| 244 | 244 | * |
| 245 | 245 | * @return array |
| 246 | 246 | */ |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | /** |
| 263 | 263 | * Find query by method name. |
| 264 | 264 | * |
| 265 | - * @param $method |
|
| 265 | + * @param string $method |
|
| 266 | 266 | * |
| 267 | 267 | * @return static |
| 268 | 268 | */ |
@@ -331,9 +331,9 @@ discard block |
||
| 331 | 331 | |
| 332 | 332 | $this->setSort(); |
| 333 | 333 | |
| 334 | - $this->queries->reject(function ($query) { |
|
| 334 | + $this->queries->reject(function($query) { |
|
| 335 | 335 | return $query['method'] == 'paginate'; |
| 336 | - })->each(function ($query) { |
|
| 336 | + })->each(function($query) { |
|
| 337 | 337 | $this->model = $this->model->{$query['method']}(...$query['arguments']); |
| 338 | 338 | }); |
| 339 | 339 | |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | $this->setSort(); |
| 385 | 385 | $this->setPaginate(); |
| 386 | 386 | |
| 387 | - $this->queries->unique()->each(function ($query) { |
|
| 387 | + $this->queries->unique()->each(function($query) { |
|
| 388 | 388 | $this->model = call_user_func_array([$this->model, $query['method']], $query['arguments']); |
| 389 | 389 | }); |
| 390 | 390 | |
@@ -414,9 +414,9 @@ discard block |
||
| 414 | 414 | |
| 415 | 415 | $queryBuilder = $this->originalModel; |
| 416 | 416 | |
| 417 | - $this->queries->reject(function ($query) { |
|
| 417 | + $this->queries->reject(function($query) { |
|
| 418 | 418 | return in_array($query['method'], ['get', 'paginate']); |
| 419 | - })->each(function ($query) use (&$queryBuilder) { |
|
| 419 | + })->each(function($query) use (&$queryBuilder) { |
|
| 420 | 420 | $queryBuilder = $queryBuilder->{$query['method']}(...$query['arguments']); |
| 421 | 421 | }); |
| 422 | 422 | |
@@ -450,11 +450,11 @@ discard block |
||
| 450 | 450 | { |
| 451 | 451 | $paginate = $this->findQueryByMethod('paginate'); |
| 452 | 452 | |
| 453 | - $this->queries = $this->queries->reject(function ($query) { |
|
| 453 | + $this->queries = $this->queries->reject(function($query) { |
|
| 454 | 454 | return $query['method'] == 'paginate'; |
| 455 | 455 | }); |
| 456 | 456 | |
| 457 | - if (! $this->usePaginate) { |
|
| 457 | + if (!$this->usePaginate) { |
|
| 458 | 458 | $query = [ |
| 459 | 459 | 'method' => 'get', |
| 460 | 460 | 'arguments' => [], |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | */ |
| 509 | 509 | protected function findQueryByMethod($method) |
| 510 | 510 | { |
| 511 | - return $this->queries->first(function ($query) use ($method) { |
|
| 511 | + return $this->queries->first(function($query) use ($method) { |
|
| 512 | 512 | return $query['method'] == $method; |
| 513 | 513 | }); |
| 514 | 514 | } |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | protected function setSort() |
| 522 | 522 | { |
| 523 | 523 | $this->sort = \request($this->sortName, []); |
| 524 | - if (! is_array($this->sort)) { |
|
| 524 | + if (!is_array($this->sort)) { |
|
| 525 | 525 | return; |
| 526 | 526 | } |
| 527 | 527 | |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | } |
| 532 | 532 | |
| 533 | 533 | $columnNameContainsDots = Str::contains($columnName, '.'); |
| 534 | - $isRelation = $this->queries->contains(function ($query) use ($columnName) { |
|
| 534 | + $isRelation = $this->queries->contains(function($query) use ($columnName) { |
|
| 535 | 535 | return $query['method'] === 'with' && in_array($columnName, $query['arguments'], true); |
| 536 | 536 | }); |
| 537 | 537 | if ($columnNameContainsDots === true && $isRelation) { |
@@ -549,7 +549,7 @@ discard block |
||
| 549 | 549 | } |
| 550 | 550 | |
| 551 | 551 | // get column. if contains "cast", set set column as cast |
| 552 | - if (! empty($this->sort['cast'])) { |
|
| 552 | + if (!empty($this->sort['cast'])) { |
|
| 553 | 553 | $column = "CAST({$columnName} AS {$this->sort['cast']}) {$this->sort['type']}"; |
| 554 | 554 | $method = 'orderByRaw'; |
| 555 | 555 | $arguments = [$column]; |
@@ -577,7 +577,7 @@ discard block |
||
| 577 | 577 | { |
| 578 | 578 | [$relationName, $relationColumn] = explode('.', $column); |
| 579 | 579 | |
| 580 | - if ($this->queries->contains(function ($query) use ($relationName) { |
|
| 580 | + if ($this->queries->contains(function($query) use ($relationName) { |
|
| 581 | 581 | return $query['method'] == 'with' && in_array($relationName, $query['arguments']); |
| 582 | 582 | })) { |
| 583 | 583 | $relation = $this->model->$relationName(); |
@@ -611,7 +611,7 @@ discard block |
||
| 611 | 611 | */ |
| 612 | 612 | public function resetOrderBy() |
| 613 | 613 | { |
| 614 | - $this->queries = $this->queries->reject(function ($query) { |
|
| 614 | + $this->queries = $this->queries->reject(function($query) { |
|
| 615 | 615 | return $query['method'] == 'orderBy' || $query['method'] == 'orderByDesc'; |
| 616 | 616 | }); |
| 617 | 617 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | /** |
| 26 | 26 | * Execute the console command. |
| 27 | 27 | * |
| 28 | - * @return void |
|
| 28 | + * @return false|null |
|
| 29 | 29 | */ |
| 30 | 30 | public function handle() |
| 31 | 31 | { |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | */ |
| 40 | 40 | public function handle() |
| 41 | 41 | { |
| 42 | - if (! $this->modelExists()) { |
|
| 42 | + if (!$this->modelExists()) { |
|
| 43 | 43 | $this->error('Model does not exists !'); |
| 44 | 44 | |
| 45 | 45 | return false; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | $stub = $this->option('stub'); |
| 49 | 49 | |
| 50 | - if ($stub and ! is_file($stub)) { |
|
| 50 | + if ($stub and !is_file($stub)) { |
|
| 51 | 51 | $this->error('The stub file dose not exist.'); |
| 52 | 52 | |
| 53 | 53 | return false; |
@@ -131,7 +131,7 @@ |
||
| 131 | 131 | /** |
| 132 | 132 | * Get options of HTTP methods select field. |
| 133 | 133 | * |
| 134 | - * @return array |
|
| 134 | + * @return callable |
|
| 135 | 135 | */ |
| 136 | 136 | protected function getHttpMethodsOptions() |
| 137 | 137 | { |
@@ -32,8 +32,8 @@ discard block |
||
| 32 | 32 | $grid->column('slug', trans('admin.slug')); |
| 33 | 33 | $grid->column('name', trans('admin.name')); |
| 34 | 34 | |
| 35 | - $grid->column('http_path', trans('admin.route'))->display(function ($path) { |
|
| 36 | - return collect(explode("\n", $path))->map(function ($path) { |
|
| 35 | + $grid->column('http_path', trans('admin.route'))->display(function($path) { |
|
| 36 | + return collect(explode("\n", $path))->map(function($path) { |
|
| 37 | 37 | $method = $this->http_method ?: ['ANY']; |
| 38 | 38 | |
| 39 | 39 | if (Str::contains($path, ':')) { |
@@ -41,13 +41,13 @@ discard block |
||
| 41 | 41 | $method = explode(',', $method); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - $method = collect($method)->map(function ($name) { |
|
| 44 | + $method = collect($method)->map(function($name) { |
|
| 45 | 45 | return strtoupper($name); |
| 46 | - })->map(function ($name) { |
|
| 46 | + })->map(function($name) { |
|
| 47 | 47 | return "<span class='label label-primary'>{$name}</span>"; |
| 48 | 48 | })->implode(' '); |
| 49 | 49 | |
| 50 | - if (! empty(config('admin.route.prefix'))) { |
|
| 50 | + if (!empty(config('admin.route.prefix'))) { |
|
| 51 | 51 | $path = '/'.trim(config('admin.route.prefix'), '/').$path; |
| 52 | 52 | } |
| 53 | 53 | |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | $grid->column('created_at', trans('admin.created_at')); |
| 59 | 59 | $grid->column('updated_at', trans('admin.updated_at')); |
| 60 | 60 | |
| 61 | - $grid->tools(function (Grid\Tools $tools) { |
|
| 62 | - $tools->batch(function (Grid\Tools\BatchActions $actions) { |
|
| 61 | + $grid->tools(function(Grid\Tools $tools) { |
|
| 62 | + $tools->batch(function(Grid\Tools\BatchActions $actions) { |
|
| 63 | 63 | $actions->disableDelete(); |
| 64 | 64 | }); |
| 65 | 65 | }); |
@@ -84,8 +84,8 @@ discard block |
||
| 84 | 84 | $show->field('slug', trans('admin.slug')); |
| 85 | 85 | $show->field('name', trans('admin.name')); |
| 86 | 86 | |
| 87 | - $show->field('http_path', trans('admin.route'))->unescape()->as(function ($path) { |
|
| 88 | - return collect(explode("\r\n", $path))->map(function ($path) { |
|
| 87 | + $show->field('http_path', trans('admin.route'))->unescape()->as(function($path) { |
|
| 88 | + return collect(explode("\r\n", $path))->map(function($path) { |
|
| 89 | 89 | $method = $this->http_method ?: ['ANY']; |
| 90 | 90 | |
| 91 | 91 | if (Str::contains($path, ':')) { |
@@ -93,13 +93,13 @@ discard block |
||
| 93 | 93 | $method = explode(',', $method); |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - $method = collect($method)->map(function ($name) { |
|
| 96 | + $method = collect($method)->map(function($name) { |
|
| 97 | 97 | return strtoupper($name); |
| 98 | - })->map(function ($name) { |
|
| 98 | + })->map(function($name) { |
|
| 99 | 99 | return "<span class='label label-primary'>{$name}</span>"; |
| 100 | 100 | })->implode(' '); |
| 101 | 101 | |
| 102 | - if (! empty(config('admin.route.prefix'))) { |
|
| 102 | + if (!empty(config('admin.route.prefix'))) { |
|
| 103 | 103 | $path = '/'.trim(config('admin.route.prefix'), '/').$path; |
| 104 | 104 | } |
| 105 | 105 | |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | * |
| 22 | 22 | * @param array|callable|string $options |
| 23 | 23 | * |
| 24 | - * @return $this|mixed |
|
| 24 | + * @return Checkbox |
|
| 25 | 25 | */ |
| 26 | 26 | public function options($options = []) |
| 27 | 27 | { |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | * |
| 29 | 29 | * @param string $target |
| 30 | 30 | * |
| 31 | - * @return mixed |
|
| 31 | + * @return string |
|
| 32 | 32 | */ |
| 33 | 33 | public function callInterventionMethods($target) |
| 34 | 34 | { |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function callInterventionMethods($target) |
| 45 | 45 | { |
| 46 | - if (! empty($this->interventionCalls)) { |
|
| 46 | + if (!empty($this->interventionCalls)) { |
|
| 47 | 47 | $image = ImageManagerStatic::make($target); |
| 48 | 48 | |
| 49 | 49 | foreach ($this->interventionCalls as $call) { |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | return $this; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - if (! class_exists(ImageManagerStatic::class)) { |
|
| 76 | + if (!class_exists(ImageManagerStatic::class)) { |
|
| 77 | 77 | throw new \Exception('To use image handling and manipulation, please install [intervention/image] first.'); |
| 78 | 78 | } |
| 79 | 79 | |
@@ -170,11 +170,11 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | $action = $size[2] ?? 'resize'; |
| 172 | 172 | // Resize image with aspect ratio |
| 173 | - $image->$action($size[0], $size[1], function (Constraint $constraint) { |
|
| 173 | + $image->$action($size[0], $size[1], function(Constraint $constraint) { |
|
| 174 | 174 | $constraint->aspectRatio(); |
| 175 | 175 | })->resizeCanvas($size[0], $size[1], 'center', false, '#ffffff'); |
| 176 | 176 | |
| 177 | - if (! is_null($this->storagePermission)) { |
|
| 177 | + if (!is_null($this->storagePermission)) { |
|
| 178 | 178 | $this->storage->put("{$this->getDirectory()}/{$path}", $image->encode(), $this->storagePermission); |
| 179 | 179 | } else { |
| 180 | 180 | $this->storage->put("{$this->getDirectory()}/{$path}", $image->encode()); |
@@ -292,7 +292,7 @@ |
||
| 292 | 292 | /** |
| 293 | 293 | * Get the html and script of template. |
| 294 | 294 | * |
| 295 | - * @return array |
|
| 295 | + * @return string[] |
|
| 296 | 296 | */ |
| 297 | 297 | public function getTemplateHtmlAndScript() |
| 298 | 298 | { |
@@ -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); |