@@ -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 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | |
| 227 | 227 | $this->overwriteExistingField($name); |
| 228 | 228 | |
| 229 | - return tap($field, function ($field) { |
|
| 229 | + return tap($field, function($field) { |
|
| 230 | 230 | $this->fields->push($field); |
| 231 | 231 | }); |
| 232 | 232 | } |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | |
| 249 | 249 | $this->overwriteExistingRelation($name); |
| 250 | 250 | |
| 251 | - return tap($relation, function ($relation) { |
|
| 251 | + return tap($relation, function($relation) { |
|
| 252 | 252 | $this->relations->push($relation); |
| 253 | 253 | }); |
| 254 | 254 | } |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | $this->fields = $this->fields->filter( |
| 268 | - function (Field $field) use ($name) { |
|
| 268 | + function(Field $field) use ($name) { |
|
| 269 | 269 | return $field->getName() != $name; |
| 270 | 270 | } |
| 271 | 271 | ); |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | $this->relations = $this->relations->filter( |
| 286 | - function (Relation $relation) use ($name) { |
|
| 286 | + function(Relation $relation) use ($name) { |
|
| 287 | 287 | return $relation->getName() != $name; |
| 288 | 288 | } |
| 289 | 289 | ); |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | */ |
| 341 | 341 | public function setWidth($fieldWidth = 8, $labelWidth = 2) |
| 342 | 342 | { |
| 343 | - collect($this->fields)->each(function ($field) use ($fieldWidth, $labelWidth) { |
|
| 343 | + collect($this->fields)->each(function($field) use ($fieldWidth, $labelWidth) { |
|
| 344 | 344 | $field->setWidth($fieldWidth, $labelWidth); |
| 345 | 345 | }); |
| 346 | 346 | |
@@ -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> |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | return $ret; |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - collect(explode(',', $id))->filter()->each(function ($id) { |
|
| 244 | + collect(explode(',', $id))->filter()->each(function($id) { |
|
| 245 | 245 | $builder = $this->model()->newQuery(); |
| 246 | 246 | |
| 247 | 247 | if ($this->isSoftDeletes) { |
@@ -294,9 +294,9 @@ discard block |
||
| 294 | 294 | |
| 295 | 295 | $data = $model->toArray(); |
| 296 | 296 | |
| 297 | - $this->builder->fields()->filter(function ($field) { |
|
| 297 | + $this->builder->fields()->filter(function($field) { |
|
| 298 | 298 | return $field instanceof Field\File; |
| 299 | - })->each(function (Field\File $file) use ($data) { |
|
| 299 | + })->each(function(Field\File $file) use ($data) { |
|
| 300 | 300 | $file->setOriginal($data); |
| 301 | 301 | |
| 302 | 302 | $file->destroy(); |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | return $response; |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - DB::transaction(function () { |
|
| 324 | + DB::transaction(function() { |
|
| 325 | 325 | $inserts = $this->prepareInsert($this->updates); |
| 326 | 326 | |
| 327 | 327 | foreach ($inserts as $column => $value) { |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | |
| 395 | 395 | /** @var Field $field */ |
| 396 | 396 | foreach ($this->builder()->fields() as $field) { |
| 397 | - if (! \request()->has($field->column())) { |
|
| 397 | + if (!\request()->has($field->column())) { |
|
| 398 | 398 | continue; |
| 399 | 399 | } |
| 400 | 400 | |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | return $response; |
| 524 | 524 | } |
| 525 | 525 | |
| 526 | - DB::transaction(function () { |
|
| 526 | + DB::transaction(function() { |
|
| 527 | 527 | $updates = $this->prepareUpdate($this->updates); |
| 528 | 528 | |
| 529 | 529 | foreach ($updates as $column => $value) { |
@@ -1003,7 +1003,7 @@ discard block |
||
| 1003 | 1003 | protected function getFieldByColumn($column) |
| 1004 | 1004 | { |
| 1005 | 1005 | return $this->builder->fields()->first( |
| 1006 | - function (Field $field) use ($column) { |
|
| 1006 | + function(Field $field) use ($column) { |
|
| 1007 | 1007 | if (is_array($field->column())) { |
| 1008 | 1008 | return in_array($column, $field->column()); |
| 1009 | 1009 | } |
@@ -1022,7 +1022,7 @@ discard block |
||
| 1022 | 1022 | { |
| 1023 | 1023 | $values = $this->model->toArray(); |
| 1024 | 1024 | |
| 1025 | - $this->builder->fields()->each(function (Field $field) use ($values) { |
|
| 1025 | + $this->builder->fields()->each(function(Field $field) use ($values) { |
|
| 1026 | 1026 | $field->setOriginal($values); |
| 1027 | 1027 | }); |
| 1028 | 1028 | } |
@@ -1050,7 +1050,7 @@ discard block |
||
| 1050 | 1050 | |
| 1051 | 1051 | $data = $this->model->toArray(); |
| 1052 | 1052 | |
| 1053 | - $this->builder->fields()->each(function (Field $field) use ($data) { |
|
| 1053 | + $this->builder->fields()->each(function(Field $field) use ($data) { |
|
| 1054 | 1054 | if (!in_array($field->column(), $this->ignored, true)) { |
| 1055 | 1055 | $field->fill($data); |
| 1056 | 1056 | } |
@@ -1180,7 +1180,7 @@ discard block |
||
| 1180 | 1180 | */ |
| 1181 | 1181 | public function setWidth($fieldWidth = 8, $labelWidth = 2): self |
| 1182 | 1182 | { |
| 1183 | - $this->builder()->fields()->each(function ($field) use ($fieldWidth, $labelWidth) { |
|
| 1183 | + $this->builder()->fields()->each(function($field) use ($fieldWidth, $labelWidth) { |
|
| 1184 | 1184 | /* @var Field $field */ |
| 1185 | 1185 | $field->setWidth($fieldWidth, $labelWidth); |
| 1186 | 1186 | }); |