@@ -42,7 +42,7 @@ |
||
| 42 | 42 | if (empty($selectedOption)) { |
| 43 | 43 | $selected = $this->choice('Please choose a role for the user', $selectedOption, null, null, true); |
| 44 | 44 | |
| 45 | - $roles = $roles->filter(function ($role) use ($selected) { |
|
| 45 | + $roles = $roles->filter(function($role) use ($selected) { |
|
| 46 | 46 | return in_array($role->name, $selected); |
| 47 | 47 | }); |
| 48 | 48 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | /** |
| 48 | - * @return mixed |
|
| 48 | + * @return string |
|
| 49 | 49 | */ |
| 50 | 50 | protected function getModelClass() |
| 51 | 51 | { |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | /** |
| 89 | 89 | * Get name of this column. |
| 90 | 90 | * |
| 91 | - * @return mixed |
|
| 91 | + * @return string |
|
| 92 | 92 | */ |
| 93 | 93 | public function getName() |
| 94 | 94 | { |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | /** |
| 113 | 113 | * Get label of the column. |
| 114 | 114 | * |
| 115 | - * @return mixed |
|
| 115 | + * @return string |
|
| 116 | 116 | */ |
| 117 | 117 | public function getLabel() |
| 118 | 118 | { |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Encore\Admin\Grid; |
| 4 | 4 | |
| 5 | -use Carbon\Carbon; |
|
| 6 | 5 | use Closure; |
| 7 | 6 | use Encore\Admin\Actions\RowAction; |
| 8 | 7 | use Encore\Admin\Grid; |
@@ -431,7 +431,7 @@ discard block |
||
| 431 | 431 | |
| 432 | 432 | $column = $this; |
| 433 | 433 | |
| 434 | - return $this->display(function ($value) use ($grid, $column, $abstract, $arguments) { |
|
| 434 | + return $this->display(function($value) use ($grid, $column, $abstract, $arguments) { |
|
| 435 | 435 | /** @var AbstractDisplayer $displayer */ |
| 436 | 436 | $displayer = new $abstract($value, $grid, $column, $this); |
| 437 | 437 | |
@@ -480,7 +480,7 @@ discard block |
||
| 480 | 480 | |
| 481 | 481 | $grid = $this->grid; |
| 482 | 482 | |
| 483 | - return $this->display(function ($_, $column) use ($action, $grid) { |
|
| 483 | + return $this->display(function($_, $column) use ($action, $grid) { |
|
| 484 | 484 | /** @var RowAction $action */ |
| 485 | 485 | $action = new $action(); |
| 486 | 486 | |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | $grid = $this->grid; |
| 609 | 609 | $column = $this; |
| 610 | 610 | |
| 611 | - $this->display(function ($value) use ($grid, $column, $class) { |
|
| 611 | + $this->display(function($value) use ($grid, $column, $class) { |
|
| 612 | 612 | /** @var AbstractDisplayer $definition */ |
| 613 | 613 | $definition = new $class($value, $grid, $column, $this); |
| 614 | 614 | |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | protected function htmlEntityEncode($item) |
| 627 | 627 | { |
| 628 | 628 | if (is_array($item)) { |
| 629 | - array_walk_recursive($item, function (&$value) { |
|
| 629 | + array_walk_recursive($item, function(&$value) { |
|
| 630 | 630 | $value = htmlentities($value); |
| 631 | 631 | }); |
| 632 | 632 | } else { |
@@ -663,7 +663,7 @@ discard block |
||
| 663 | 663 | */ |
| 664 | 664 | protected function callSupportDisplayer($abstract, $arguments) |
| 665 | 665 | { |
| 666 | - return $this->display(function ($value) use ($abstract, $arguments) { |
|
| 666 | + return $this->display(function($value) use ($abstract, $arguments) { |
|
| 667 | 667 | if (is_array($value) || $value instanceof Arrayable) { |
| 668 | 668 | return call_user_func_array([collect($value), $abstract], $arguments); |
| 669 | 669 | } |
@@ -687,7 +687,7 @@ discard block |
||
| 687 | 687 | protected function callBuiltinDisplayer($abstract, $arguments) |
| 688 | 688 | { |
| 689 | 689 | if ($abstract instanceof Closure) { |
| 690 | - return $this->display(function ($value) use ($abstract, $arguments) { |
|
| 690 | + return $this->display(function($value) use ($abstract, $arguments) { |
|
| 691 | 691 | return $abstract->call($this, ...array_merge([$value], $arguments)); |
| 692 | 692 | }); |
| 693 | 693 | } |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | $grid = $this->grid; |
| 697 | 697 | $column = $this; |
| 698 | 698 | |
| 699 | - return $this->display(function ($value) use ($abstract, $grid, $column, $arguments) { |
|
| 699 | + return $this->display(function($value) use ($abstract, $grid, $column, $arguments) { |
|
| 700 | 700 | /** @var AbstractDisplayer $displayer */ |
| 701 | 701 | $displayer = new $abstract($value, $grid, $column, $this); |
| 702 | 702 | |
@@ -112,7 +112,7 @@ |
||
| 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(); |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | /** |
| 10 | 10 | * Get all permissions of user. |
| 11 | 11 | * |
| 12 | - * @return mixed |
|
| 12 | + * @return Collection |
|
| 13 | 13 | */ |
| 14 | 14 | public function allPermissions(): Collection |
| 15 | 15 | { |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | /** |
| 20 | 20 | * Check if user has permission. |
| 21 | 21 | * |
| 22 | - * @param $ability |
|
| 22 | + * @param string $ability |
|
| 23 | 23 | * @param array $arguments |
| 24 | 24 | * |
| 25 | 25 | * @return bool |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | /** |
| 57 | 57 | * Check if user is administrator. |
| 58 | 58 | * |
| 59 | - * @return mixed |
|
| 59 | + * @return boolean |
|
| 60 | 60 | */ |
| 61 | 61 | public function isAdministrator(): bool |
| 62 | 62 | { |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * |
| 69 | 69 | * @param string $role |
| 70 | 70 | * |
| 71 | - * @return mixed |
|
| 71 | + * @return boolean |
|
| 72 | 72 | */ |
| 73 | 73 | public function isRole(string $role): bool |
| 74 | 74 | { |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @param array $roles |
| 82 | 82 | * |
| 83 | - * @return mixed |
|
| 83 | + * @return boolean |
|
| 84 | 84 | */ |
| 85 | 85 | public function inRoles(array $roles = []): bool |
| 86 | 86 | { |
@@ -347,9 +347,9 @@ discard block |
||
| 347 | 347 | |
| 348 | 348 | $this->setSort(); |
| 349 | 349 | |
| 350 | - $this->queries->reject(function ($query) { |
|
| 350 | + $this->queries->reject(function($query) { |
|
| 351 | 351 | return $query['method'] == 'paginate'; |
| 352 | - })->each(function ($query) { |
|
| 352 | + })->each(function($query) { |
|
| 353 | 353 | $this->model = $this->model->{$query['method']}(...$query['arguments']); |
| 354 | 354 | }); |
| 355 | 355 | |
@@ -400,7 +400,7 @@ discard block |
||
| 400 | 400 | $this->setSort(); |
| 401 | 401 | $this->setPaginate(); |
| 402 | 402 | |
| 403 | - $this->queries->unique()->each(function ($query) { |
|
| 403 | + $this->queries->unique()->each(function($query) { |
|
| 404 | 404 | $this->model = call_user_func_array([$this->model, $query['method']], $query['arguments']); |
| 405 | 405 | }); |
| 406 | 406 | |
@@ -430,9 +430,9 @@ discard block |
||
| 430 | 430 | |
| 431 | 431 | $queryBuilder = $this->originalModel; |
| 432 | 432 | |
| 433 | - $this->queries->reject(function ($query) { |
|
| 433 | + $this->queries->reject(function($query) { |
|
| 434 | 434 | return in_array($query['method'], ['get', 'paginate']); |
| 435 | - })->each(function ($query) use (&$queryBuilder) { |
|
| 435 | + })->each(function($query) use (&$queryBuilder) { |
|
| 436 | 436 | $queryBuilder = $queryBuilder->{$query['method']}(...$query['arguments']); |
| 437 | 437 | }); |
| 438 | 438 | |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | { |
| 467 | 467 | $paginate = $this->findQueryByMethod('paginate'); |
| 468 | 468 | |
| 469 | - $this->queries = $this->queries->reject(function ($query) { |
|
| 469 | + $this->queries = $this->queries->reject(function($query) { |
|
| 470 | 470 | return $query['method'] == 'paginate'; |
| 471 | 471 | }); |
| 472 | 472 | |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | */ |
| 525 | 525 | protected function findQueryByMethod($method) |
| 526 | 526 | { |
| 527 | - return $this->queries->first(function ($query) use ($method) { |
|
| 527 | + return $this->queries->first(function($query) use ($method) { |
|
| 528 | 528 | return $query['method'] == $method; |
| 529 | 529 | }); |
| 530 | 530 | } |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | $columnNameContainsDots = Str::contains($columnName, '.'); |
| 550 | - $isRelation = $this->queries->contains(function ($query) use ($columnName) { |
|
| 550 | + $isRelation = $this->queries->contains(function($query) use ($columnName) { |
|
| 551 | 551 | return $query['method'] === 'with' && in_array($columnName, $query['arguments'], true); |
| 552 | 552 | }); |
| 553 | 553 | if ($columnNameContainsDots === true && $isRelation) { |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | { |
| 594 | 594 | list($relationName, $relationColumn) = explode('.', $column); |
| 595 | 595 | |
| 596 | - if ($this->queries->contains(function ($query) use ($relationName) { |
|
| 596 | + if ($this->queries->contains(function($query) use ($relationName) { |
|
| 597 | 597 | return $query['method'] == 'with' && in_array($relationName, $query['arguments']); |
| 598 | 598 | })) { |
| 599 | 599 | $relation = $this->model->$relationName(); |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | */ |
| 628 | 628 | public function resetOrderBy() |
| 629 | 629 | { |
| 630 | - $this->queries = $this->queries->reject(function ($query) { |
|
| 630 | + $this->queries = $this->queries->reject(function($query) { |
|
| 631 | 631 | return $query['method'] == 'orderBy' || $query['method'] == 'orderByDesc'; |
| 632 | 632 | }); |
| 633 | 633 | } |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | /** |
| 468 | 468 | * Resolve perPage for pagination. |
| 469 | 469 | * |
| 470 | - * @param array|null $paginate |
|
| 470 | + * @param Model $paginate |
|
| 471 | 471 | * |
| 472 | 472 | * @return array |
| 473 | 473 | */ |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | /** |
| 498 | 498 | * Find query by method name. |
| 499 | 499 | * |
| 500 | - * @param $method |
|
| 500 | + * @param string $method |
|
| 501 | 501 | * |
| 502 | 502 | * @return static |
| 503 | 503 | */ |
@@ -651,7 +651,7 @@ discard block |
||
| 651 | 651 | |
| 652 | 652 | /** |
| 653 | 653 | * @param string $method |
| 654 | - * @param array $arguments |
|
| 654 | + * @param integer[] $arguments |
|
| 655 | 655 | * |
| 656 | 656 | * @return $this |
| 657 | 657 | */ |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | * @param array $forms |
| 14 | 14 | * @param null $active |
| 15 | 15 | * |
| 16 | - * @return mixed |
|
| 16 | + * @return ContainsForms |
|
| 17 | 17 | */ |
| 18 | 18 | public static function forms($forms, $active = null) |
| 19 | 19 | { |
@@ -26,10 +26,10 @@ discard block |
||
| 26 | 26 | return $content |
| 27 | 27 | ->title(trans('admin.menu')) |
| 28 | 28 | ->description(trans('admin.list')) |
| 29 | - ->row(function (Row $row) { |
|
| 29 | + ->row(function(Row $row) { |
|
| 30 | 30 | $row->column(6, $this->treeView()->render()); |
| 31 | 31 | |
| 32 | - $row->column(6, function (Column $column) { |
|
| 32 | + $row->column(6, function(Column $column) { |
|
| 33 | 33 | $form = new \Encore\Admin\Widgets\Form(); |
| 34 | 34 | $form->action(admin_url('auth/menu')); |
| 35 | 35 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | $tree->disableCreate(); |
| 77 | 77 | |
| 78 | - $tree->branch(function ($branch) { |
|
| 78 | + $tree->branch(function($branch) { |
|
| 79 | 79 | $payload = "<i class='fa {$branch['icon']}'></i> <strong>{$branch['title']}</strong>"; |
| 80 | 80 | |
| 81 | 81 | if (!isset($branch['children'])) { |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function handle() |
| 50 | 50 | { |
| 51 | - $routes = collect($this->router->getRoutes())->filter(function (Route $route) { |
|
| 51 | + $routes = collect($this->router->getRoutes())->filter(function(Route $route) { |
|
| 52 | 52 | $uri = $route->uri(); |
| 53 | 53 | // built-in, parameterized and no-GET are ignored |
| 54 | 54 | return Str::startsWith($uri, 'admin/') |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | && !Str::contains($uri, '{') |
| 58 | 58 | && in_array('GET', $route->methods()); |
| 59 | 59 | }) |
| 60 | - ->map(function (Route $route) { |
|
| 60 | + ->map(function(Route $route) { |
|
| 61 | 61 | $uri = substr($route->uri(), strlen('admin/')); |
| 62 | 62 | |
| 63 | 63 | return [ |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | $menus = Menu::all()->pluck('title', 'uri'); |
| 73 | 73 | // exclude exist ones |
| 74 | - $news = $routes->diffKeys($menus)->map(function ($item, $key) { |
|
| 74 | + $news = $routes->diffKeys($menus)->map(function($item, $key) { |
|
| 75 | 75 | return [ |
| 76 | 76 | 'title' => $item, |
| 77 | 77 | 'uri' => $key, |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | } else { |
| 86 | 86 | if ($this->hasOption('dry-run') && $this->option('dry-run')) { |
| 87 | 87 | $this->line('<info>The following menu items will be created</info>: '); |
| 88 | - $this->table(['Title', 'Uri'], array_map(function ($item) { |
|
| 88 | + $this->table(['Title', 'Uri'], array_map(function($item) { |
|
| 89 | 89 | return [ |
| 90 | 90 | $item['title'], |
| 91 | 91 | $item['uri'], |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | // for create or update |
| 156 | 156 | if ($this->pathColumn) { |
| 157 | - $targets = array_map(function ($target) { |
|
| 157 | + $targets = array_map(function($target) { |
|
| 158 | 158 | return [$this->pathColumn => $target]; |
| 159 | 159 | }, $targets); |
| 160 | 160 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | { |
| 186 | 186 | $this->name = $this->getStoreName($file); |
| 187 | 187 | |
| 188 | - return tap($this->upload($file), function () { |
|
| 188 | + return tap($this->upload($file), function() { |
|
| 189 | 189 | $this->name = null; |
| 190 | 190 | }); |
| 191 | 191 | } |