@@ -55,7 +55,7 @@ |
||
55 | 55 | */ |
56 | 56 | public function render() |
57 | 57 | { |
58 | - return $this->tools->map(function ($tool) { |
|
58 | + return $this->tools->map(function($tool) { |
|
59 | 59 | if ($tool instanceof Renderable) { |
60 | 60 | return $tool->render(); |
61 | 61 | } |
@@ -113,7 +113,7 @@ |
||
113 | 113 | protected function initBranchCallback() |
114 | 114 | { |
115 | 115 | if (is_null($this->branchCallback)) { |
116 | - $this->branchCallback = function ($branch) { |
|
116 | + $this->branchCallback = function($branch) { |
|
117 | 117 | $key = $branch[$this->model->getKeyName()]; |
118 | 118 | $title = $branch[$this->model->getTitleColumn()]; |
119 | 119 |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | |
224 | 224 | $this->overwriteExistingField($name); |
225 | 225 | |
226 | - return tap($field, function ($field) { |
|
226 | + return tap($field, function($field) { |
|
227 | 227 | $this->fields->push($field); |
228 | 228 | }); |
229 | 229 | } |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | |
246 | 246 | $this->overwriteExistingRelation($name); |
247 | 247 | |
248 | - return tap($relation, function ($relation) { |
|
248 | + return tap($relation, function($relation) { |
|
249 | 249 | $this->relations->push($relation); |
250 | 250 | }); |
251 | 251 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | } |
263 | 263 | |
264 | 264 | $this->fields = $this->fields->filter( |
265 | - function (Field $field) use ($name) { |
|
265 | + function(Field $field) use ($name) { |
|
266 | 266 | return $field->getName() != $name; |
267 | 267 | } |
268 | 268 | ); |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | } |
281 | 281 | |
282 | 282 | $this->relations = $this->relations->filter( |
283 | - function (Relation $relation) use ($name) { |
|
283 | + function(Relation $relation) use ($name) { |
|
284 | 284 | return $relation->getName() != $name; |
285 | 285 | } |
286 | 286 | ); |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | */ |
338 | 338 | public function setWidth($fieldWidth = 8, $labelWidth = 2) |
339 | 339 | { |
340 | - collect($this->fields)->each(function ($field) use ($fieldWidth, $labelWidth) { |
|
340 | + collect($this->fields)->each(function($field) use ($fieldWidth, $labelWidth) { |
|
341 | 341 | $field->each->setWidth($fieldWidth, $labelWidth); |
342 | 342 | }); |
343 | 343 |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | return $ret; |
368 | 368 | } |
369 | 369 | |
370 | - collect(explode(',', $id))->filter()->each(function ($id) { |
|
370 | + collect(explode(',', $id))->filter()->each(function($id) { |
|
371 | 371 | $builder = $this->model()->newQuery(); |
372 | 372 | |
373 | 373 | if ($this->isSoftDeletes) { |
@@ -420,9 +420,9 @@ discard block |
||
420 | 420 | |
421 | 421 | $data = $model->toArray(); |
422 | 422 | |
423 | - $this->builder->fields()->filter(function ($field) { |
|
423 | + $this->builder->fields()->filter(function($field) { |
|
424 | 424 | return $field instanceof Field\File; |
425 | - })->each(function (Field\File $file) use ($data) { |
|
425 | + })->each(function(Field\File $file) use ($data) { |
|
426 | 426 | $file->setOriginal($data); |
427 | 427 | |
428 | 428 | $file->destroy(); |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | return $response; |
448 | 448 | } |
449 | 449 | |
450 | - DB::transaction(function () { |
|
450 | + DB::transaction(function() { |
|
451 | 451 | $inserts = $this->prepareInsert($this->updates); |
452 | 452 | |
453 | 453 | foreach ($inserts as $column => $value) { |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | return $response; |
618 | 618 | } |
619 | 619 | |
620 | - DB::transaction(function () { |
|
620 | + DB::transaction(function() { |
|
621 | 621 | $updates = $this->prepareUpdate($this->updates); |
622 | 622 | |
623 | 623 | foreach ($updates as $column => $value) { |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | protected function getFieldByColumn($column) |
1098 | 1098 | { |
1099 | 1099 | return $this->builder->fields()->first( |
1100 | - function (Field $field) use ($column) { |
|
1100 | + function(Field $field) use ($column) { |
|
1101 | 1101 | if (is_array($field->column())) { |
1102 | 1102 | return in_array($column, $field->column()); |
1103 | 1103 | } |
@@ -1118,7 +1118,7 @@ discard block |
||
1118 | 1118 | |
1119 | 1119 | $values = $this->model->toArray(); |
1120 | 1120 | |
1121 | - $this->builder->fields()->each(function (Field $field) use ($values) { |
|
1121 | + $this->builder->fields()->each(function(Field $field) use ($values) { |
|
1122 | 1122 | $field->setOriginal($values); |
1123 | 1123 | }); |
1124 | 1124 | } |
@@ -1148,7 +1148,7 @@ discard block |
||
1148 | 1148 | |
1149 | 1149 | $data = $this->model->toArray(); |
1150 | 1150 | |
1151 | - $this->builder->fields()->each(function (Field $field) use ($data) { |
|
1151 | + $this->builder->fields()->each(function(Field $field) use ($data) { |
|
1152 | 1152 | if (!in_array($field->column(), $this->ignored)) { |
1153 | 1153 | $field->fill($data); |
1154 | 1154 | } |
@@ -1292,7 +1292,7 @@ discard block |
||
1292 | 1292 | */ |
1293 | 1293 | public function setWidth($fieldWidth = 8, $labelWidth = 2) |
1294 | 1294 | { |
1295 | - $this->builder()->fields()->each(function ($field) use ($fieldWidth, $labelWidth) { |
|
1295 | + $this->builder()->fields()->each(function($field) use ($fieldWidth, $labelWidth) { |
|
1296 | 1296 | /* @var Field $field */ |
1297 | 1297 | $field->setWidth($fieldWidth, $labelWidth); |
1298 | 1298 | }); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public function using(array $values, $default = null) |
193 | 193 | { |
194 | - return $this->as(function ($value) use ($values, $default) { |
|
194 | + return $this->as(function($value) use ($values, $default) { |
|
195 | 195 | if (is_null($value)) { |
196 | 196 | return $default; |
197 | 197 | } |
@@ -211,8 +211,8 @@ discard block |
||
211 | 211 | */ |
212 | 212 | public function image($server = '', $width = 200, $height = 200) |
213 | 213 | { |
214 | - return $this->unescape()->as(function ($images) use ($server, $width, $height) { |
|
215 | - return collect($images)->map(function ($path) use ($server, $width, $height) { |
|
214 | + return $this->unescape()->as(function($images) use ($server, $width, $height) { |
|
215 | + return collect($images)->map(function($path) use ($server, $width, $height) { |
|
216 | 216 | if (empty($path)) { |
217 | 217 | return ''; |
218 | 218 | } |
@@ -247,8 +247,8 @@ discard block |
||
247 | 247 | */ |
248 | 248 | public function carousel($width = 300, $height = 200, $server = '') |
249 | 249 | { |
250 | - return $this->unescape()->as(function ($images) use ($server, $width, $height) { |
|
251 | - $items = collect($images)->map(function ($path) use ($server, $width, $height) { |
|
250 | + return $this->unescape()->as(function($images) use ($server, $width, $height) { |
|
251 | + $items = collect($images)->map(function($path) use ($server, $width, $height) { |
|
252 | 252 | if (empty($path)) { |
253 | 253 | return ''; |
254 | 254 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | { |
289 | 289 | $field = $this; |
290 | 290 | |
291 | - return $this->unescape()->as(function ($path) use ($server, $download, $field) { |
|
291 | + return $this->unescape()->as(function($path) use ($server, $download, $field) { |
|
292 | 292 | $name = basename($path); |
293 | 293 | |
294 | 294 | $field->border = false; |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | */ |
343 | 343 | public function link($href = '', $target = '_blank') |
344 | 344 | { |
345 | - return $this->unescape()->as(function ($link) use ($href, $target) { |
|
345 | + return $this->unescape()->as(function($link) use ($href, $target) { |
|
346 | 346 | $href = $href ?: $link; |
347 | 347 | |
348 | 348 | return "<a href='$href' target='{$target}'>{$link}</a>"; |
@@ -358,12 +358,12 @@ discard block |
||
358 | 358 | */ |
359 | 359 | public function label($style = 'success') |
360 | 360 | { |
361 | - return $this->unescape()->as(function ($value) use ($style) { |
|
361 | + return $this->unescape()->as(function($value) use ($style) { |
|
362 | 362 | if ($value instanceof Arrayable) { |
363 | 363 | $value = $value->toArray(); |
364 | 364 | } |
365 | 365 | |
366 | - return collect((array) $value)->map(function ($name) use ($style) { |
|
366 | + return collect((array) $value)->map(function($name) use ($style) { |
|
367 | 367 | return "<span class='label label-{$style}'>$name</span>"; |
368 | 368 | })->implode(' '); |
369 | 369 | }); |
@@ -378,12 +378,12 @@ discard block |
||
378 | 378 | */ |
379 | 379 | public function badge($style = 'blue') |
380 | 380 | { |
381 | - return $this->unescape()->as(function ($value) use ($style) { |
|
381 | + return $this->unescape()->as(function($value) use ($style) { |
|
382 | 382 | if ($value instanceof Arrayable) { |
383 | 383 | $value = $value->toArray(); |
384 | 384 | } |
385 | 385 | |
386 | - return collect((array) $value)->map(function ($name) use ($style) { |
|
386 | + return collect((array) $value)->map(function($name) use ($style) { |
|
387 | 387 | return "<span class='badge bg-{$style}'>$name</span>"; |
388 | 388 | })->implode(' '); |
389 | 389 | }); |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | { |
399 | 399 | $field = $this; |
400 | 400 | |
401 | - return $this->unescape()->as(function ($value) use ($field) { |
|
401 | + return $this->unescape()->as(function($value) use ($field) { |
|
402 | 402 | $content = json_decode($value, true); |
403 | 403 | |
404 | 404 | if (json_last_error() == 0) { |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | */ |
419 | 419 | public function filesize() |
420 | 420 | { |
421 | - return $this->as(function ($value) { |
|
421 | + return $this->as(function($value) { |
|
422 | 422 | return file_size($value); |
423 | 423 | }); |
424 | 424 | } |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | |
558 | 558 | $field = $this; |
559 | 559 | |
560 | - return $this->as(function ($value) use ($extend, $field, $arguments) { |
|
560 | + return $this->as(function($value) use ($extend, $field, $arguments) { |
|
561 | 561 | if (!$extend->border) { |
562 | 562 | $field->border = false; |
563 | 563 | } |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | public function render() |
617 | 617 | { |
618 | 618 | if ($this->showAs->isNotEmpty()) { |
619 | - $this->showAs->each(function ($callable) { |
|
619 | + $this->showAs->each(function($callable) { |
|
620 | 620 | $this->value = $callable->call( |
621 | 621 | $this->parent->getModel(), |
622 | 622 | $this->value |
@@ -293,7 +293,7 @@ |
||
293 | 293 | */ |
294 | 294 | protected function renderCustomTools($tools) |
295 | 295 | { |
296 | - return $tools->map(function ($tool) { |
|
296 | + return $tools->map(function($tool) { |
|
297 | 297 | if ($tool instanceof Renderable) { |
298 | 298 | return $tool->render(); |
299 | 299 | } |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | { |
198 | 198 | static::$branchOrder = array_flip(Arr::flatten($order)); |
199 | 199 | |
200 | - static::$branchOrder = array_map(function ($item) { |
|
200 | + static::$branchOrder = array_map(function($item) { |
|
201 | 201 | return ++$item; |
202 | 202 | }, static::$branchOrder); |
203 | 203 | } |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | { |
299 | 299 | parent::boot(); |
300 | 300 | |
301 | - static::saving(function (Model $branch) { |
|
301 | + static::saving(function(Model $branch) { |
|
302 | 302 | $parentColumn = $branch->getParentColumn(); |
303 | 303 | |
304 | 304 | if (Request::has($parentColumn) && Request::input($parentColumn) == $branch->getKey()) { |
@@ -21,7 +21,7 @@ |
||
21 | 21 | } |
22 | 22 | |
23 | 23 | if (is_array($permission)) { |
24 | - collect($permission)->each(function ($permission) { |
|
24 | + collect($permission)->each(function($permission) { |
|
25 | 25 | call_user_func([self::class, 'check'], $permission); |
26 | 26 | }); |
27 | 27 |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | $method = $this->http_method; |
68 | 68 | |
69 | - $matches = array_map(function ($path) use ($method) { |
|
69 | + $matches = array_map(function($path) use ($method) { |
|
70 | 70 | $path = trim(config('admin.route.prefix'), '/').$path; |
71 | 71 | |
72 | 72 | if (Str::contains($path, ':')) { |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | return false; |
119 | 119 | } |
120 | 120 | |
121 | - $method = collect($match['method'])->filter()->map(function ($method) { |
|
121 | + $method = collect($match['method'])->filter()->map(function($method) { |
|
122 | 122 | return strtoupper($method); |
123 | 123 | }); |
124 | 124 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | { |
159 | 159 | parent::boot(); |
160 | 160 | |
161 | - static::deleting(function ($model) { |
|
161 | + static::deleting(function($model) { |
|
162 | 162 | $model->roles()->detach(); |
163 | 163 | }); |
164 | 164 | } |