@@ -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 | |
@@ -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 { |
@@ -102,9 +102,9 @@ discard block |
||
| 102 | 102 | */ |
| 103 | 103 | protected function applyCascadeConditions() |
| 104 | 104 | { |
| 105 | - if( $this->form ) { |
|
| 105 | + if ($this->form) { |
|
| 106 | 106 | $this->form->fields() |
| 107 | - ->filter(function (Form\Field $field) { |
|
| 107 | + ->filter(function(Form\Field $field) { |
|
| 108 | 108 | return $field instanceof CascadeGroup |
| 109 | 109 | && $field->dependsOn($this) |
| 110 | 110 | && $this->hitsCondition($field); |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | return; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - $cascadeGroups = collect($this->conditions)->map(function ($condition) { |
|
| 165 | + $cascadeGroups = collect($this->conditions)->map(function($condition) { |
|
| 166 | 166 | return [ |
| 167 | 167 | 'class' => $this->getCascadeClass($condition['value']), |
| 168 | 168 | 'operator' => $condition['operator'], |
@@ -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 | { |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | |
| 326 | 326 | libxml_use_internal_errors(true); |
| 327 | 327 | |
| 328 | - $dom->loadHTML('<?xml encoding="utf-8" ?>' . $str); |
|
| 328 | + $dom->loadHTML('<?xml encoding="utf-8" ?>'.$str); |
|
| 329 | 329 | |
| 330 | 330 | libxml_use_internal_errors(false); |
| 331 | 331 | |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | if ($child instanceof \DOMElement && $child->tagName == 'script') { |
| 347 | - static::script(';(function () {' . $child->nodeValue . '})();'); |
|
| 347 | + static::script(';(function () {'.$child->nodeValue.'})();'); |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | if ($child instanceof \DOMElement && $child->tagName == 'template') { |