@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function using(array $values, $default = null) |
181 | 181 | { |
182 | - return $this->as(function ($value) use ($values, $default) { |
|
182 | + return $this->as(function($value) use ($values, $default) { |
|
183 | 183 | if (is_null($value)) { |
184 | 184 | return $default; |
185 | 185 | } |
@@ -199,8 +199,8 @@ discard block |
||
199 | 199 | */ |
200 | 200 | public function image($server = '', $width = 200, $height = 200) |
201 | 201 | { |
202 | - return $this->unescape()->as(function ($images) use ($server, $width, $height) { |
|
203 | - return collect($images)->map(function ($path) use ($server, $width, $height) { |
|
202 | + return $this->unescape()->as(function($images) use ($server, $width, $height) { |
|
203 | + return collect($images)->map(function($path) use ($server, $width, $height) { |
|
204 | 204 | if (empty($path)) { |
205 | 205 | return ''; |
206 | 206 | } |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | { |
237 | 237 | $field = $this; |
238 | 238 | |
239 | - return $this->unescape()->as(function ($path) use ($server, $download, $field) { |
|
239 | + return $this->unescape()->as(function($path) use ($server, $download, $field) { |
|
240 | 240 | $name = basename($path); |
241 | 241 | |
242 | 242 | $field->border = false; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | */ |
289 | 289 | public function link($href = '', $target = '_blank') |
290 | 290 | { |
291 | - return $this->unescape()->as(function ($link) use ($href, $target) { |
|
291 | + return $this->unescape()->as(function($link) use ($href, $target) { |
|
292 | 292 | $href = $href ?: $link; |
293 | 293 | |
294 | 294 | return "<a href='$href' target='{$target}'>{$link}</a>"; |
@@ -304,12 +304,12 @@ discard block |
||
304 | 304 | */ |
305 | 305 | public function label($style = 'success') |
306 | 306 | { |
307 | - return $this->unescape()->as(function ($value) use ($style) { |
|
307 | + return $this->unescape()->as(function($value) use ($style) { |
|
308 | 308 | if ($value instanceof Arrayable) { |
309 | 309 | $value = $value->toArray(); |
310 | 310 | } |
311 | 311 | |
312 | - return collect((array) $value)->map(function ($name) use ($style) { |
|
312 | + return collect((array) $value)->map(function($name) use ($style) { |
|
313 | 313 | return "<span class='label label-{$style}'>$name</span>"; |
314 | 314 | })->implode(' '); |
315 | 315 | }); |
@@ -324,12 +324,12 @@ discard block |
||
324 | 324 | */ |
325 | 325 | public function badge($style = 'blue') |
326 | 326 | { |
327 | - return $this->unescape()->as(function ($value) use ($style) { |
|
327 | + return $this->unescape()->as(function($value) use ($style) { |
|
328 | 328 | if ($value instanceof Arrayable) { |
329 | 329 | $value = $value->toArray(); |
330 | 330 | } |
331 | 331 | |
332 | - return collect((array) $value)->map(function ($name) use ($style) { |
|
332 | + return collect((array) $value)->map(function($name) use ($style) { |
|
333 | 333 | return "<span class='badge bg-{$style}'>$name</span>"; |
334 | 334 | })->implode(' '); |
335 | 335 | }); |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | { |
345 | 345 | $field = $this; |
346 | 346 | |
347 | - return $this->unescape()->as(function ($value) use ($field) { |
|
347 | + return $this->unescape()->as(function($value) use ($field) { |
|
348 | 348 | $content = json_decode($value, true); |
349 | 349 | |
350 | 350 | if (json_last_error() == 0) { |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | |
474 | 474 | $field = $this; |
475 | 475 | |
476 | - return $this->as(function ($value) use ($extend, $field, $arguments) { |
|
476 | + return $this->as(function($value) use ($extend, $field, $arguments) { |
|
477 | 477 | if (!$extend->border) { |
478 | 478 | $field->border = false; |
479 | 479 | } |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | public function render() |
532 | 532 | { |
533 | 533 | if ($this->showAs->isNotEmpty()) { |
534 | - $this->showAs->each(function ($callable) { |
|
534 | + $this->showAs->each(function($callable) { |
|
535 | 535 | $this->value = $callable->call( |
536 | 536 | $this->parent->getModel(), |
537 | 537 | $this->value |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | $this->setupScript(); |
43 | 43 | |
44 | - $lists = $columns->map(function ($val, $key) use ($show) { |
|
44 | + $lists = $columns->map(function($val, $key) use ($show) { |
|
45 | 45 | if (empty($show)) { |
46 | 46 | $checked = 'checked'; |
47 | 47 | } else { |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | protected function getGridColumns() |
94 | 94 | { |
95 | - return $this->grid->columns()->map(function (Grid\Column $column) { |
|
95 | + return $this->grid->columns()->map(function(Grid\Column $column) { |
|
96 | 96 | $name = $column->getName(); |
97 | 97 | |
98 | 98 | if (in_array($name, ['__row_selector__', '__actions__'])) { |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | |
223 | 223 | $this->overwriteExistingField($name); |
224 | 224 | |
225 | - return tap($field, function ($field) { |
|
225 | + return tap($field, function($field) { |
|
226 | 226 | $this->fields->push($field); |
227 | 227 | }); |
228 | 228 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | |
245 | 245 | $this->overwriteExistingRelation($name); |
246 | 246 | |
247 | - return tap($relation, function ($relation) { |
|
247 | + return tap($relation, function($relation) { |
|
248 | 248 | $this->relations->push($relation); |
249 | 249 | }); |
250 | 250 | } |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | } |
262 | 262 | |
263 | 263 | $this->fields = $this->fields->filter( |
264 | - function (Field $field) use ($name) { |
|
264 | + function(Field $field) use ($name) { |
|
265 | 265 | return $field->getName() != $name; |
266 | 266 | } |
267 | 267 | ); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | } |
280 | 280 | |
281 | 281 | $this->relations = $this->relations->filter( |
282 | - function (Relation $relation) use ($name) { |
|
282 | + function(Relation $relation) use ($name) { |
|
283 | 283 | return $relation->getName() != $name; |
284 | 284 | } |
285 | 285 | ); |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | */ |
337 | 337 | public function setWidth($fieldWidth = 8, $labelWidth = 2) |
338 | 338 | { |
339 | - collect($this->fields)->each(function ($field) use ($fieldWidth, $labelWidth) { |
|
339 | + collect($this->fields)->each(function($field) use ($fieldWidth, $labelWidth) { |
|
340 | 340 | $field->each->setWidth($fieldWidth, $labelWidth); |
341 | 341 | }); |
342 | 342 |
@@ -49,7 +49,7 @@ |
||
49 | 49 | |
50 | 50 | $eagerLoads = array_keys($this->getQuery()->getEagerLoads()); |
51 | 51 | |
52 | - $columns = collect($columns)->reject(function ($column) use ($eagerLoads) { |
|
52 | + $columns = collect($columns)->reject(function($column) use ($eagerLoads) { |
|
53 | 53 | return Str::contains($column, '.') || in_array($column, $eagerLoads); |
54 | 54 | }); |
55 | 55 |
@@ -22,12 +22,12 @@ discard block |
||
22 | 22 | 'Content-Disposition' => "attachment; filename=\"$filename\"", |
23 | 23 | ]; |
24 | 24 | |
25 | - response()->stream(function () { |
|
25 | + response()->stream(function() { |
|
26 | 26 | $handle = fopen('php://output', 'w'); |
27 | 27 | |
28 | 28 | $titles = []; |
29 | 29 | |
30 | - $this->chunk(function ($records) use ($handle, &$titles) { |
|
30 | + $this->chunk(function($records) use ($handle, &$titles) { |
|
31 | 31 | if (empty($titles)) { |
32 | 32 | $titles = $this->getHeaderRowFromRecords($records); |
33 | 33 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | public function getHeaderRowFromRecords(Collection $records): array |
56 | 56 | { |
57 | 57 | $titles = collect(Arr::dot($records->first()->toArray()))->keys()->map( |
58 | - function ($key) { |
|
58 | + function($key) { |
|
59 | 59 | $key = str_replace('.', ' ', $key); |
60 | 60 | |
61 | 61 | return Str::ucfirst($key); |
@@ -23,7 +23,7 @@ |
||
23 | 23 | $columns = $titles; |
24 | 24 | } |
25 | 25 | |
26 | - $data = array_map(function ($item) use ($columns) { |
|
26 | + $data = array_map(function($item) use ($columns) { |
|
27 | 27 | $sorted = []; |
28 | 28 | |
29 | 29 | $arr = Arr::only($item, $columns); |
@@ -65,7 +65,7 @@ |
||
65 | 65 | |
66 | 66 | $this->value = Arr::get($inputs, $this->column); |
67 | 67 | |
68 | - $value = array_filter($this->value, function ($val) { |
|
68 | + $value = array_filter($this->value, function($val) { |
|
69 | 69 | return $val !== ''; |
70 | 70 | }); |
71 | 71 |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | */ |
280 | 280 | protected function removeFilterByID($id) |
281 | 281 | { |
282 | - $this->filters = array_filter($this->filters, function (AbstractFilter $filter) use ($id) { |
|
282 | + $this->filters = array_filter($this->filters, function(AbstractFilter $filter) use ($id) { |
|
283 | 283 | return $filter->getId() != $id; |
284 | 284 | }); |
285 | 285 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | { |
294 | 294 | $inputs = Arr::dot(Input::all()); |
295 | 295 | |
296 | - $inputs = array_filter($inputs, function ($input) { |
|
296 | + $inputs = array_filter($inputs, function($input) { |
|
297 | 297 | return $input !== '' && !is_null($input); |
298 | 298 | }); |
299 | 299 | |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
324 | - return tap(array_filter($conditions), function ($conditions) { |
|
324 | + return tap(array_filter($conditions), function($conditions) { |
|
325 | 325 | if (!empty($conditions)) { |
326 | 326 | $this->expand(); |
327 | 327 | } |
@@ -339,9 +339,9 @@ discard block |
||
339 | 339 | return $inputs; |
340 | 340 | } |
341 | 341 | |
342 | - $inputs = collect($inputs)->filter(function ($input, $key) { |
|
342 | + $inputs = collect($inputs)->filter(function($input, $key) { |
|
343 | 343 | return Str::startsWith($key, "{$this->name}_"); |
344 | - })->mapWithKeys(function ($val, $key) { |
|
344 | + })->mapWithKeys(function($val, $key) { |
|
345 | 345 | $key = str_replace("{$this->name}_", '', $key); |
346 | 346 | |
347 | 347 | return [$key => $val]; |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | */ |
412 | 412 | public function scope($key, $label = '') |
413 | 413 | { |
414 | - return tap(new Scope($key, $label), function (Scope $scope) { |
|
414 | + return tap(new Scope($key, $label), function(Scope $scope) { |
|
415 | 415 | return $this->scopes->push($scope); |
416 | 416 | }); |
417 | 417 | } |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | { |
436 | 436 | $key = request(Scope::QUERY_NAME); |
437 | 437 | |
438 | - return $this->scopes->first(function ($scope) use ($key) { |
|
438 | + return $this->scopes->first(function($scope) use ($key) { |
|
439 | 439 | return $scope->key == $key; |
440 | 440 | }); |
441 | 441 | } |
@@ -555,9 +555,9 @@ discard block |
||
555 | 555 | |
556 | 556 | $columns->push($pageKey); |
557 | 557 | |
558 | - $groupNames = collect($this->filters)->filter(function ($filter) { |
|
558 | + $groupNames = collect($this->filters)->filter(function($filter) { |
|
559 | 559 | return $filter instanceof Group; |
560 | - })->map(function (AbstractFilter $filter) { |
|
560 | + })->map(function(AbstractFilter $filter) { |
|
561 | 561 | return "{$filter->getId()}_group"; |
562 | 562 | }); |
563 | 563 |
@@ -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 | } |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | { |
295 | 295 | parent::boot(); |
296 | 296 | |
297 | - static::saving(function (Model $branch) { |
|
297 | + static::saving(function(Model $branch) { |
|
298 | 298 | $parentColumn = $branch->getParentColumn(); |
299 | 299 | |
300 | 300 | if (Request::has($parentColumn) && Request::input($parentColumn) == $branch->getKey()) { |