@@ -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 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | ]; |
30 | 30 | |
31 | 31 | try { |
32 | - DB::transaction(function () use ($model) { |
|
32 | + DB::transaction(function() use ($model) { |
|
33 | 33 | $model->delete(); |
34 | 34 | }); |
35 | 35 | } catch (\Exception $exception) { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $this->disablePagination(); |
87 | 87 | } |
88 | 88 | |
89 | - $this->tools(function (Tools $tools) { |
|
89 | + $this->tools(function(Tools $tools) { |
|
90 | 90 | $tools->append(new Grid\Selectable\BrowserBtn()); |
91 | 91 | }); |
92 | 92 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | $hide = $hide ? 'hide' : ''; |
99 | 99 | $key = $this->key; |
100 | 100 | |
101 | - $this->column('__remove__', ' ')->display(function () use ($hide, $key) { |
|
101 | + $this->column('__remove__', ' ')->display(function() use ($hide, $key) { |
|
102 | 102 | return <<<BTN |
103 | 103 | <a href="javascript:void(0);" class="grid-row-remove {$hide}" data-key="{$this->getAttribute($key)}"> |
104 | 104 | <i class="fa fa-trash"></i> |
@@ -67,7 +67,6 @@ |
||
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
70 | - * @param bool $multiple |
|
71 | 70 | * |
72 | 71 | * @return string |
73 | 72 | */ |
@@ -57,6 +57,10 @@ |
||
57 | 57 | }); |
58 | 58 | } |
59 | 59 | |
60 | + /** |
|
61 | + * @param string $title |
|
62 | + * @param \Illuminate\Support\Collection $diff |
|
63 | + */ |
|
60 | 64 | protected function printDiff($title, $diff, $error = false) |
61 | 65 | { |
62 | 66 | if ($diff->isEmpty()) { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | { |
53 | 53 | return collect(Arr::dot($from)) |
54 | 54 | ->keys() |
55 | - ->reject(function ($key) use ($to) { |
|
55 | + ->reject(function($key) use ($to) { |
|
56 | 56 | return Arr::has($to, $key); |
57 | 57 | }); |
58 | 58 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $this->line(''); |
67 | 67 | $this->comment("{$title}:"); |
68 | 68 | |
69 | - $diff->each(function ($key) use ($error) { |
|
69 | + $diff->each(function($key) use ($error) { |
|
70 | 70 | if ($error) { |
71 | 71 | $this->error(" {$key}"); |
72 | 72 | } else { |