@@ -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 | */ |
@@ -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 | */ |
@@ -325,9 +325,9 @@ discard block |
||
325 | 325 | |
326 | 326 | $this->setSort(); |
327 | 327 | |
328 | - $this->queries->reject(function ($query) { |
|
328 | + $this->queries->reject(function($query) { |
|
329 | 329 | return $query['method'] == 'paginate'; |
330 | - })->each(function ($query) { |
|
330 | + })->each(function($query) { |
|
331 | 331 | $this->model = $this->model->{$query['method']}(...$query['arguments']); |
332 | 332 | }); |
333 | 333 | |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | $this->setSort(); |
379 | 379 | $this->setPaginate(); |
380 | 380 | |
381 | - $this->queries->unique()->each(function ($query) { |
|
381 | + $this->queries->unique()->each(function($query) { |
|
382 | 382 | $this->model = call_user_func_array([$this->model, $query['method']], $query['arguments']); |
383 | 383 | }); |
384 | 384 | |
@@ -408,9 +408,9 @@ discard block |
||
408 | 408 | |
409 | 409 | $queryBuilder = $this->originalModel; |
410 | 410 | |
411 | - $this->queries->reject(function ($query) { |
|
411 | + $this->queries->reject(function($query) { |
|
412 | 412 | return in_array($query['method'], ['get', 'paginate']); |
413 | - })->each(function ($query) use (&$queryBuilder) { |
|
413 | + })->each(function($query) use (&$queryBuilder) { |
|
414 | 414 | $queryBuilder = $queryBuilder->{$query['method']}(...$query['arguments']); |
415 | 415 | }); |
416 | 416 | |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | { |
445 | 445 | $paginate = $this->findQueryByMethod('paginate'); |
446 | 446 | |
447 | - $this->queries = $this->queries->reject(function ($query) { |
|
447 | + $this->queries = $this->queries->reject(function($query) { |
|
448 | 448 | return $query['method'] == 'paginate'; |
449 | 449 | }); |
450 | 450 | |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | */ |
503 | 503 | protected function findQueryByMethod($method) |
504 | 504 | { |
505 | - return $this->queries->first(function ($query) use ($method) { |
|
505 | + return $this->queries->first(function($query) use ($method) { |
|
506 | 506 | return $query['method'] == $method; |
507 | 507 | }); |
508 | 508 | } |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | } |
526 | 526 | |
527 | 527 | $columnNameContainsDots = Str::contains($columnName, '.'); |
528 | - $isRelation = $this->queries->contains(function ($query) use ($columnName) { |
|
528 | + $isRelation = $this->queries->contains(function($query) use ($columnName) { |
|
529 | 529 | return $query['method'] === 'with' && Str::contains($columnName, $query['arguments']); |
530 | 530 | }); |
531 | 531 | if ($columnNameContainsDots === true && $isRelation) { |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | { |
572 | 572 | list($relationName, $relationColumn) = explode('.', $column); |
573 | 573 | |
574 | - if ($this->queries->contains(function ($query) use ($relationName) { |
|
574 | + if ($this->queries->contains(function($query) use ($relationName) { |
|
575 | 575 | return $query['method'] == 'with' && in_array($relationName, $query['arguments']); |
576 | 576 | })) { |
577 | 577 | $relation = $this->model->$relationName(); |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | */ |
606 | 606 | public function resetOrderBy() |
607 | 607 | { |
608 | - $this->queries = $this->queries->reject(function ($query) { |
|
608 | + $this->queries = $this->queries->reject(function($query) { |
|
609 | 609 | return $query['method'] == 'orderBy' || $query['method'] == 'orderByDesc'; |
610 | 610 | }); |
611 | 611 | } |
@@ -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 { |
@@ -315,7 +315,7 @@ |
||
315 | 315 | } |
316 | 316 | |
317 | 317 | /** |
318 | - * @param $component |
|
318 | + * @param string $component |
|
319 | 319 | */ |
320 | 320 | public static function component($component, $data = []) |
321 | 321 | { |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | $script = collect(static::$script) |
234 | 234 | ->merge(static::$deferredScript) |
235 | 235 | ->unique() |
236 | - ->map(function ($line) { |
|
236 | + ->map(function($line) { |
|
237 | 237 | return $line; |
238 | 238 | //@see https://stackoverflow.com/questions/19509863/how-to-remove-js-comments-using-php |
239 | 239 | $pattern = '/(?:(?:\/\*(?:[^*]|(?:\*+[^*\/]))*\*+\/)|(?:(?<!\:|\\\|\')\/\/.*))/'; |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | |
259 | 259 | $style = collect(static::$style) |
260 | 260 | ->unique() |
261 | - ->map(function ($line) { |
|
261 | + ->map(function($line) { |
|
262 | 262 | return preg_replace('/\s+/', ' ', $line); |
263 | 263 | }); |
264 | 264 |