@@ -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 { |
@@ -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 | |