@@ -198,13 +198,13 @@ |
||
| 198 | 198 | */ |
| 199 | 199 | protected function selected($model, $textField = 'name', $idField = 'id') |
| 200 | 200 | { |
| 201 | - $this->options = function ($resource) use ($model, $textField, $idField) { |
|
| 201 | + $this->options = function($resource) use ($model, $textField, $idField) { |
|
| 202 | 202 | if (null == $resource) { |
| 203 | 203 | return []; |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | if (is_array($resource) && !empty($resource) && isset($resource[0]['id'])) { |
| 207 | - $resource = array_map(function ($res) { |
|
| 207 | + $resource = array_map(function($res) { |
|
| 208 | 208 | return $res['id']; |
| 209 | 209 | }, $resource); |
| 210 | 210 | } elseif (is_array($resource) && !empty($resource) && isset($resource['id'])) { |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | */ |
| 313 | 313 | public function using(array $values, $default = null) |
| 314 | 314 | { |
| 315 | - return $this->display(function ($value) use ($values, $default) { |
|
| 315 | + return $this->display(function($value) use ($values, $default) { |
|
| 316 | 316 | if (is_null($value)) { |
| 317 | 317 | return $default; |
| 318 | 318 | } |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | */ |
| 331 | 331 | public function view($view) |
| 332 | 332 | { |
| 333 | - return $this->display(function ($value) use ($view) { |
|
| 333 | + return $this->display(function($value) use ($view) { |
|
| 334 | 334 | $model = $this; |
| 335 | 335 | |
| 336 | 336 | return view($view, compact('model', 'value'))->render(); |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | $grid = $this->grid; |
| 453 | 453 | $column = $this; |
| 454 | 454 | |
| 455 | - $this->display(function ($value) use ($grid, $column, $class) { |
|
| 455 | + $this->display(function($value) use ($grid, $column, $class) { |
|
| 456 | 456 | /** @var AbstractDisplayer $definition */ |
| 457 | 457 | $definition = new $class($value, $grid, $column, $this); |
| 458 | 458 | |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | protected function htmlEntityEncode($item) |
| 471 | 471 | { |
| 472 | 472 | if (is_array($item)) { |
| 473 | - array_walk_recursive($item, function (&$value) { |
|
| 473 | + array_walk_recursive($item, function(&$value) { |
|
| 474 | 474 | $value = htmlentities($value); |
| 475 | 475 | }); |
| 476 | 476 | } else { |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | */ |
| 551 | 551 | protected function callSupportDisplayer($abstract, $arguments) |
| 552 | 552 | { |
| 553 | - return $this->display(function ($value) use ($abstract, $arguments) { |
|
| 553 | + return $this->display(function($value) use ($abstract, $arguments) { |
|
| 554 | 554 | if (is_array($value) || $value instanceof Arrayable) { |
| 555 | 555 | return call_user_func_array([collect($value), $abstract], $arguments); |
| 556 | 556 | } |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | protected function callBuiltinDisplayer($abstract, $arguments) |
| 575 | 575 | { |
| 576 | 576 | if ($abstract instanceof Closure) { |
| 577 | - return $this->display(function ($value) use ($abstract, $arguments) { |
|
| 577 | + return $this->display(function($value) use ($abstract, $arguments) { |
|
| 578 | 578 | return $abstract->call($this, ...array_merge([$value], $arguments)); |
| 579 | 579 | }); |
| 580 | 580 | } |
@@ -583,7 +583,7 @@ discard block |
||
| 583 | 583 | $grid = $this->grid; |
| 584 | 584 | $column = $this; |
| 585 | 585 | |
| 586 | - return $this->display(function ($value) use ($abstract, $grid, $column, $arguments) { |
|
| 586 | + return $this->display(function($value) use ($abstract, $grid, $column, $arguments) { |
|
| 587 | 587 | $displayer = new $abstract($value, $grid, $column, $this); |
| 588 | 588 | |
| 589 | 589 | return $displayer->display(...$arguments); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | */ |
| 173 | 173 | public function using(array $values, $default = null) |
| 174 | 174 | { |
| 175 | - return $this->as(function ($value) use ($values, $default) { |
|
| 175 | + return $this->as(function($value) use ($values, $default) { |
|
| 176 | 176 | if (is_null($value)) { |
| 177 | 177 | return $default; |
| 178 | 178 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | */ |
| 193 | 193 | public function image($server = '', $width = 200, $height = 200) |
| 194 | 194 | { |
| 195 | - return $this->as(function ($path) use ($server, $width, $height) { |
|
| 195 | + return $this->as(function($path) use ($server, $width, $height) { |
|
| 196 | 196 | if (empty($path)) { |
| 197 | 197 | return ''; |
| 198 | 198 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | { |
| 228 | 228 | $field = $this; |
| 229 | 229 | |
| 230 | - return $this->as(function ($path) use ($server, $download, $field) { |
|
| 230 | + return $this->as(function($path) use ($server, $download, $field) { |
|
| 231 | 231 | $name = basename($path); |
| 232 | 232 | |
| 233 | 233 | $field->wrapped = false; |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | */ |
| 276 | 276 | public function link($href = '', $target = '_blank') |
| 277 | 277 | { |
| 278 | - return $this->as(function ($link) use ($href, $target) { |
|
| 278 | + return $this->as(function($link) use ($href, $target) { |
|
| 279 | 279 | $href = $href ?: $link; |
| 280 | 280 | |
| 281 | 281 | return "<a href='$href' target='{$target}'>{$link}</a>"; |
@@ -291,12 +291,12 @@ discard block |
||
| 291 | 291 | */ |
| 292 | 292 | public function label($style = 'success') |
| 293 | 293 | { |
| 294 | - return $this->as(function ($value) use ($style) { |
|
| 294 | + return $this->as(function($value) use ($style) { |
|
| 295 | 295 | if ($value instanceof Arrayable) { |
| 296 | 296 | $value = $value->toArray(); |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | - return collect((array) $value)->map(function ($name) use ($style) { |
|
| 299 | + return collect((array) $value)->map(function($name) use ($style) { |
|
| 300 | 300 | return "<span class='label label-{$style}'>$name</span>"; |
| 301 | 301 | })->implode(' '); |
| 302 | 302 | }); |
@@ -311,12 +311,12 @@ discard block |
||
| 311 | 311 | */ |
| 312 | 312 | public function badge($style = 'blue') |
| 313 | 313 | { |
| 314 | - return $this->as(function ($value) use ($style) { |
|
| 314 | + return $this->as(function($value) use ($style) { |
|
| 315 | 315 | if ($value instanceof Arrayable) { |
| 316 | 316 | $value = $value->toArray(); |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - return collect((array) $value)->map(function ($name) use ($style) { |
|
| 319 | + return collect((array) $value)->map(function($name) use ($style) { |
|
| 320 | 320 | return "<span class='badge bg-{$style}'>$name</span>"; |
| 321 | 321 | })->implode(' '); |
| 322 | 322 | }); |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | { |
| 332 | 332 | $field = $this; |
| 333 | 333 | |
| 334 | - return $this->as(function ($value) use ($field) { |
|
| 334 | + return $this->as(function($value) use ($field) { |
|
| 335 | 335 | $content = json_decode($value, true); |
| 336 | 336 | |
| 337 | 337 | if (json_last_error() == 0) { |
@@ -442,7 +442,7 @@ discard block |
||
| 442 | 442 | public function render() |
| 443 | 443 | { |
| 444 | 444 | if ($this->showAs->isNotEmpty()) { |
| 445 | - $this->showAs->each(function ($callable) { |
|
| 445 | + $this->showAs->each(function($callable) { |
|
| 446 | 446 | $this->value = $callable->call( |
| 447 | 447 | $this->parent->getModel(), |
| 448 | 448 | $this->value |