@@ -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 | return join($seperator, array_fill(0, (int) $value, $input->call($this, [$value]))); |
608 | 608 | }); |
609 | 609 | } |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | */ |
621 | 621 | public function view($view) |
622 | 622 | { |
623 | - return $this->display(function ($value) use ($view) { |
|
623 | + return $this->display(function($value) use ($view) { |
|
624 | 624 | $model = $this; |
625 | 625 | |
626 | 626 | return view($view, compact('model', 'value'))->render(); |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | */ |
661 | 661 | public function filesize() |
662 | 662 | { |
663 | - return $this->display(function ($value) { |
|
663 | + return $this->display(function($value) { |
|
664 | 664 | return file_size($value); |
665 | 665 | }); |
666 | 666 | } |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | */ |
675 | 675 | public function gravatar($size = 30) |
676 | 676 | { |
677 | - return $this->display(function ($value) use ($size) { |
|
677 | + return $this->display(function($value) use ($size) { |
|
678 | 678 | $src = sprintf( |
679 | 679 | 'https://www.gravatar.com/avatar/%s?s=%d', |
680 | 680 | md5(strtolower($value)), |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | */ |
696 | 696 | public function loading($values = [], $others = []) |
697 | 697 | { |
698 | - return $this->display(function ($value) use ($values, $others) { |
|
698 | + return $this->display(function($value) use ($values, $others) { |
|
699 | 699 | $values = (array) $values; |
700 | 700 | |
701 | 701 | if (in_array($value, $values)) { |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | */ |
717 | 717 | public function icon(array $setting, $default = '') |
718 | 718 | { |
719 | - return $this->display(function ($value) use ($setting, $default) { |
|
719 | + return $this->display(function($value) use ($setting, $default) { |
|
720 | 720 | $fa = ''; |
721 | 721 | |
722 | 722 | if (isset($setting[$value])) { |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | Carbon::setLocale($locale); |
743 | 743 | } |
744 | 744 | |
745 | - return $this->display(function ($value) { |
|
745 | + return $this->display(function($value) { |
|
746 | 746 | return Carbon::parse($value)->diffForHumans(); |
747 | 747 | }); |
748 | 748 | } |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | */ |
757 | 757 | public function date($format) |
758 | 758 | { |
759 | - return $this->display(function ($value) use ($format) { |
|
759 | + return $this->display(function($value) use ($format) { |
|
760 | 760 | return date($format, strtotime($value)); |
761 | 761 | }); |
762 | 762 | } |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | */ |
772 | 772 | public function bool(array $map = [], $default = false) |
773 | 773 | { |
774 | - return $this->display(function ($value) use ($map, $default) { |
|
774 | + return $this->display(function($value) use ($map, $default) { |
|
775 | 775 | $bool = empty($map) ? boolval($value) : Arr::get($map, $value, $default); |
776 | 776 | |
777 | 777 | return $bool ? '<i class="fa fa-check text-green"></i>' : '<i class="fa fa-close text-red"></i>'; |
@@ -786,7 +786,7 @@ discard block |
||
786 | 786 | */ |
787 | 787 | public function default($default = '-') |
788 | 788 | { |
789 | - return $this->display(function ($value) use ($default) { |
|
789 | + return $this->display(function($value) use ($default) { |
|
790 | 790 | return $value ?: $default; |
791 | 791 | }); |
792 | 792 | } |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | |
807 | 807 | $grid = $this->grid; |
808 | 808 | |
809 | - return $this->display(function ($_, $column) use ($action, $grid) { |
|
809 | + return $this->display(function($_, $column) use ($action, $grid) { |
|
810 | 810 | /** @var RowAction $action */ |
811 | 811 | $action = new $action(); |
812 | 812 | |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | */ |
829 | 829 | public function dot($options = [], $default = '') |
830 | 830 | { |
831 | - return $this->prefix(function ($_, $original) use ($options, $default) { |
|
831 | + return $this->prefix(function($_, $original) use ($options, $default) { |
|
832 | 832 | if (is_null($original)) { |
833 | 833 | $style = $default; |
834 | 834 | } else { |
@@ -983,7 +983,7 @@ discard block |
||
983 | 983 | $grid = $this->grid; |
984 | 984 | $column = $this; |
985 | 985 | |
986 | - $this->display(function ($value) use ($grid, $column, $class) { |
|
986 | + $this->display(function($value) use ($grid, $column, $class) { |
|
987 | 987 | /** @var AbstractDisplayer $definition */ |
988 | 988 | $definition = new $class($value, $grid, $column, $this); |
989 | 989 | |
@@ -1001,7 +1001,7 @@ discard block |
||
1001 | 1001 | protected function htmlEntityEncode($item) |
1002 | 1002 | { |
1003 | 1003 | if (is_array($item)) { |
1004 | - array_walk_recursive($item, function (&$value) { |
|
1004 | + array_walk_recursive($item, function(&$value) { |
|
1005 | 1005 | $value = htmlentities($value); |
1006 | 1006 | }); |
1007 | 1007 | } else { |
@@ -1038,7 +1038,7 @@ discard block |
||
1038 | 1038 | */ |
1039 | 1039 | protected function callSupportDisplayer($abstract, $arguments) |
1040 | 1040 | { |
1041 | - return $this->display(function ($value) use ($abstract, $arguments) { |
|
1041 | + return $this->display(function($value) use ($abstract, $arguments) { |
|
1042 | 1042 | if (is_array($value) || $value instanceof Arrayable) { |
1043 | 1043 | return call_user_func_array([collect($value), $abstract], $arguments); |
1044 | 1044 | } |
@@ -1062,7 +1062,7 @@ discard block |
||
1062 | 1062 | protected function callBuiltinDisplayer($abstract, $arguments) |
1063 | 1063 | { |
1064 | 1064 | if ($abstract instanceof Closure) { |
1065 | - return $this->display(function ($value) use ($abstract, $arguments) { |
|
1065 | + return $this->display(function($value) use ($abstract, $arguments) { |
|
1066 | 1066 | return $abstract->call($this, ...array_merge([$value], $arguments)); |
1067 | 1067 | }); |
1068 | 1068 | } |
@@ -1071,7 +1071,7 @@ discard block |
||
1071 | 1071 | $grid = $this->grid; |
1072 | 1072 | $column = $this; |
1073 | 1073 | |
1074 | - return $this->display(function ($value) use ($abstract, $grid, $column, $arguments) { |
|
1074 | + return $this->display(function($value) use ($abstract, $grid, $column, $arguments) { |
|
1075 | 1075 | /** @var AbstractDisplayer $displayer */ |
1076 | 1076 | $displayer = new $abstract($value, $grid, $column, $this); |
1077 | 1077 |
@@ -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 { |