@@ -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) { |
@@ -139,16 +139,16 @@ discard block |
||
139 | 139 | call_user_func($this->callback, $this); |
140 | 140 | } |
141 | 141 | |
142 | - $response = function () { |
|
142 | + $response = function() { |
|
143 | 143 | $handle = fopen('php://output', 'w'); |
144 | 144 | $titles = []; |
145 | 145 | |
146 | - $this->chunk(function ($collection) use ($handle, &$titles) { |
|
146 | + $this->chunk(function($collection) use ($handle, &$titles) { |
|
147 | 147 | Column::setOriginalGridModels($collection); |
148 | 148 | |
149 | 149 | $original = $current = $collection->toArray(); |
150 | 150 | |
151 | - $this->grid->getColumns()->map(function (Column $column) use (&$current) { |
|
151 | + $this->grid->getColumns()->map(function(Column $column) use (&$current) { |
|
152 | 152 | $current = $column->fill($current); |
153 | 153 | $this->grid->columnNames[] = $column->getName(); |
154 | 154 | }); |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | protected function getVisiableTitles() |
178 | 178 | { |
179 | 179 | $titles = $this->grid->visibleColumns() |
180 | - ->mapWithKeys(function (Column $column) { |
|
180 | + ->mapWithKeys(function(Column $column) { |
|
181 | 181 | return [$column->getName() => $column->getLabel()]; |
182 | 182 | }); |
183 | 183 |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | /** |
360 | 360 | * Get name of this column. |
361 | 361 | * |
362 | - * @return mixed |
|
362 | + * @return string |
|
363 | 363 | */ |
364 | 364 | public function getName() |
365 | 365 | { |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | /** |
398 | 398 | * Get label of the column. |
399 | 399 | * |
400 | - * @return mixed |
|
400 | + * @return string |
|
401 | 401 | */ |
402 | 402 | public function getLabel() |
403 | 403 | { |
@@ -535,7 +535,7 @@ discard block |
||
535 | 535 | * Display using display abstract. |
536 | 536 | * |
537 | 537 | * @param string $abstract |
538 | - * @param array $arguments |
|
538 | + * @param string[] $arguments |
|
539 | 539 | * |
540 | 540 | * @return $this |
541 | 541 | */ |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | $name = $this->getName(); |
493 | 493 | $query = request()->query(); |
494 | 494 | |
495 | - $this->prefix(function ($_, $original) use ($name, $query) { |
|
495 | + $this->prefix(function($_, $original) use ($name, $query) { |
|
496 | 496 | Arr::set($query, $name, $original); |
497 | 497 | |
498 | 498 | $url = request()->fullUrlWithQuery($query); |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | |
544 | 544 | $column = $this; |
545 | 545 | |
546 | - return $this->display(function ($value) use ($grid, $column, $abstract, $arguments) { |
|
546 | + return $this->display(function($value) use ($grid, $column, $abstract, $arguments) { |
|
547 | 547 | /** @var AbstractDisplayer $displayer */ |
548 | 548 | $displayer = new $abstract($value, $grid, $column, $this); |
549 | 549 | |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | */ |
562 | 562 | public function using(array $values, $default = null) |
563 | 563 | { |
564 | - return $this->display(function ($value) use ($values, $default) { |
|
564 | + return $this->display(function($value) use ($values, $default) { |
|
565 | 565 | if (is_null($value)) { |
566 | 566 | return $default; |
567 | 567 | } |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | */ |
580 | 580 | public function replace(array $replacements) |
581 | 581 | { |
582 | - return $this->display(function ($value) use ($replacements) { |
|
582 | + return $this->display(function($value) use ($replacements) { |
|
583 | 583 | if (isset($replacements[$value])) { |
584 | 584 | return $replacements[$value]; |
585 | 585 | } |
@@ -597,13 +597,13 @@ discard block |
||
597 | 597 | public function repeat($input, $seperator = '') |
598 | 598 | { |
599 | 599 | if (is_string($input)) { |
600 | - $input = function () use ($input) { |
|
600 | + $input = function() use ($input) { |
|
601 | 601 | return $input; |
602 | 602 | }; |
603 | 603 | } |
604 | 604 | |
605 | 605 | if ($input instanceof Closure) { |
606 | - return $this->display(function ($value) use ($input, $seperator) { |
|
606 | + return $this->display(function($value) use ($input, $seperator) { |
|
607 | 607 | $callable = $input->bindTo($this); |
608 | 608 | return join($seperator, array_fill(0, (int) $value, $callable($value))); |
609 | 609 | }); |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | */ |
622 | 622 | public function view($view) |
623 | 623 | { |
624 | - return $this->display(function ($value) use ($view) { |
|
624 | + return $this->display(function($value) use ($view) { |
|
625 | 625 | $model = $this; |
626 | 626 | |
627 | 627 | return view($view, compact('model', 'value'))->render(); |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | */ |
662 | 662 | public function filesize() |
663 | 663 | { |
664 | - return $this->display(function ($value) { |
|
664 | + return $this->display(function($value) { |
|
665 | 665 | return file_size($value); |
666 | 666 | }); |
667 | 667 | } |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | */ |
676 | 676 | public function gravatar($size = 30) |
677 | 677 | { |
678 | - return $this->display(function ($value) use ($size) { |
|
678 | + return $this->display(function($value) use ($size) { |
|
679 | 679 | $src = sprintf( |
680 | 680 | 'https://www.gravatar.com/avatar/%s?s=%d', |
681 | 681 | md5(strtolower($value)), |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | */ |
697 | 697 | public function loading($values = [], $others = []) |
698 | 698 | { |
699 | - return $this->display(function ($value) use ($values, $others) { |
|
699 | + return $this->display(function($value) use ($values, $others) { |
|
700 | 700 | $values = (array) $values; |
701 | 701 | |
702 | 702 | if (in_array($value, $values)) { |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | */ |
718 | 718 | public function icon(array $setting, $default = '') |
719 | 719 | { |
720 | - return $this->display(function ($value) use ($setting, $default) { |
|
720 | + return $this->display(function($value) use ($setting, $default) { |
|
721 | 721 | $fa = ''; |
722 | 722 | |
723 | 723 | if (isset($setting[$value])) { |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | Carbon::setLocale($locale); |
744 | 744 | } |
745 | 745 | |
746 | - return $this->display(function ($value) { |
|
746 | + return $this->display(function($value) { |
|
747 | 747 | return Carbon::parse($value)->diffForHumans(); |
748 | 748 | }); |
749 | 749 | } |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | */ |
758 | 758 | public function date($format) |
759 | 759 | { |
760 | - return $this->display(function ($value) use ($format) { |
|
760 | + return $this->display(function($value) use ($format) { |
|
761 | 761 | return date($format, strtotime($value)); |
762 | 762 | }); |
763 | 763 | } |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | */ |
773 | 773 | public function bool(array $map = [], $default = false) |
774 | 774 | { |
775 | - return $this->display(function ($value) use ($map, $default) { |
|
775 | + return $this->display(function($value) use ($map, $default) { |
|
776 | 776 | $bool = empty($map) ? boolval($value) : Arr::get($map, $value, $default); |
777 | 777 | |
778 | 778 | return $bool ? '<i class="fa fa-check text-green"></i>' : '<i class="fa fa-close text-red"></i>'; |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | */ |
788 | 788 | public function default($default = '-') |
789 | 789 | { |
790 | - return $this->display(function ($value) use ($default) { |
|
790 | + return $this->display(function($value) use ($default) { |
|
791 | 791 | return $value ?: $default; |
792 | 792 | }); |
793 | 793 | } |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | |
808 | 808 | $grid = $this->grid; |
809 | 809 | |
810 | - return $this->display(function ($_, $column) use ($action, $grid) { |
|
810 | + return $this->display(function($_, $column) use ($action, $grid) { |
|
811 | 811 | /** @var RowAction $action */ |
812 | 812 | $action = new $action(); |
813 | 813 | |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | */ |
830 | 830 | public function dot($options = [], $default = '') |
831 | 831 | { |
832 | - return $this->prefix(function ($_, $original) use ($options, $default) { |
|
832 | + return $this->prefix(function($_, $original) use ($options, $default) { |
|
833 | 833 | if (is_null($original)) { |
834 | 834 | $style = $default; |
835 | 835 | } else { |
@@ -984,7 +984,7 @@ discard block |
||
984 | 984 | $grid = $this->grid; |
985 | 985 | $column = $this; |
986 | 986 | |
987 | - $this->display(function ($value) use ($grid, $column, $class) { |
|
987 | + $this->display(function($value) use ($grid, $column, $class) { |
|
988 | 988 | /** @var AbstractDisplayer $definition */ |
989 | 989 | $definition = new $class($value, $grid, $column, $this); |
990 | 990 | |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | protected function htmlEntityEncode($item) |
1003 | 1003 | { |
1004 | 1004 | if (is_array($item)) { |
1005 | - array_walk_recursive($item, function (&$value) { |
|
1005 | + array_walk_recursive($item, function(&$value) { |
|
1006 | 1006 | $value = htmlentities($value); |
1007 | 1007 | }); |
1008 | 1008 | } else { |
@@ -1039,7 +1039,7 @@ discard block |
||
1039 | 1039 | */ |
1040 | 1040 | protected function callSupportDisplayer($abstract, $arguments) |
1041 | 1041 | { |
1042 | - return $this->display(function ($value) use ($abstract, $arguments) { |
|
1042 | + return $this->display(function($value) use ($abstract, $arguments) { |
|
1043 | 1043 | if (is_array($value) || $value instanceof Arrayable) { |
1044 | 1044 | return call_user_func_array([collect($value), $abstract], $arguments); |
1045 | 1045 | } |
@@ -1063,7 +1063,7 @@ discard block |
||
1063 | 1063 | protected function callBuiltinDisplayer($abstract, $arguments) |
1064 | 1064 | { |
1065 | 1065 | if ($abstract instanceof Closure) { |
1066 | - return $this->display(function ($value) use ($abstract, $arguments) { |
|
1066 | + return $this->display(function($value) use ($abstract, $arguments) { |
|
1067 | 1067 | return $abstract->call($this, ...array_merge([$value], $arguments)); |
1068 | 1068 | }); |
1069 | 1069 | } |
@@ -1072,7 +1072,7 @@ discard block |
||
1072 | 1072 | $grid = $this->grid; |
1073 | 1073 | $column = $this; |
1074 | 1074 | |
1075 | - return $this->display(function ($value) use ($abstract, $grid, $column, $arguments) { |
|
1075 | + return $this->display(function($value) use ($abstract, $grid, $column, $arguments) { |
|
1076 | 1076 | /** @var AbstractDisplayer $displayer */ |
1077 | 1077 | $displayer = new $abstract($value, $grid, $column, $this); |
1078 | 1078 |
@@ -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 | */ |
@@ -79,7 +79,7 @@ |
||
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
82 | - * @param mixed $key |
|
82 | + * @param string $key |
|
83 | 83 | * |
84 | 84 | * @return mixed |
85 | 85 | */ |
@@ -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 { |