@@ -6,7 +6,7 @@ |
||
| 6 | 6 | { |
| 7 | 7 | public function display($style = 'primary', $size = 'sm', $max = 100) |
| 8 | 8 | { |
| 9 | - $style = collect((array) $style)->map(function ($style) { |
|
| 9 | + $style = collect((array) $style)->map(function($style) { |
|
| 10 | 10 | return 'progress-bar-'.$style; |
| 11 | 11 | })->implode(' '); |
| 12 | 12 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | protected function prepareValue($key, $record) |
| 163 | 163 | { |
| 164 | - $field = $this->fields->first(function (Field $field) use ($key) { |
|
| 164 | + $field = $this->fields->first(function(Field $field) use ($key) { |
|
| 165 | 165 | return in_array($key, (array) $field->column()); |
| 166 | 166 | }); |
| 167 | 167 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | if (array_key_exists($key, $this->original)) { |
| 185 | 185 | $values = $this->original[$key]; |
| 186 | 186 | |
| 187 | - $this->fields->each(function (Field $field) use ($values) { |
|
| 187 | + $this->fields->each(function(Field $field) use ($values) { |
|
| 188 | 188 | $field->setOriginal($values); |
| 189 | 189 | }); |
| 190 | 190 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | */ |
| 200 | 200 | public function fill(array $data) |
| 201 | 201 | { |
| 202 | - $this->fields->each(function (Field $field) use ($data) { |
|
| 202 | + $this->fields->each(function(Field $field) use ($data) { |
|
| 203 | 203 | $field->fill($data); |
| 204 | 204 | }); |
| 205 | 205 | |
@@ -103,7 +103,7 @@ |
||
| 103 | 103 | protected function initBranchCallback() |
| 104 | 104 | { |
| 105 | 105 | if (is_null($this->branchCallback)) { |
| 106 | - $this->branchCallback = function ($branch) { |
|
| 106 | + $this->branchCallback = function($branch) { |
|
| 107 | 107 | $key = $branch[$this->model->getKeyName()]; |
| 108 | 108 | $title = $branch[$this->model->getTitleColumn()]; |
| 109 | 109 | |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | |
| 34 | 34 | $this->callInterventionMethods($image->getRealPath()); |
| 35 | 35 | |
| 36 | - return tap($this->upload($image), function () { |
|
| 36 | + return tap($this->upload($image), function() { |
|
| 37 | 37 | $this->name = null; |
| 38 | 38 | }); |
| 39 | 39 | } |
@@ -331,7 +331,7 @@ |
||
| 331 | 331 | * |
| 332 | 332 | * @param Presenter $presenter |
| 333 | 333 | * |
| 334 | - * @return mixed |
|
| 334 | + * @return Presenter |
|
| 335 | 335 | */ |
| 336 | 336 | protected function setPresenter(Presenter $presenter) |
| 337 | 337 | { |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | public function siblings($index = null) |
| 188 | 188 | { |
| 189 | - if (! is_null($index)) { |
|
| 189 | + if (!is_null($index)) { |
|
| 190 | 190 | return Arr::get($this->parent->filters(), $index); |
| 191 | 191 | } |
| 192 | 192 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | |
| 237 | 237 | $value = Arr::get($inputs, $this->column); |
| 238 | 238 | |
| 239 | - if (! isset($value)) { |
|
| 239 | + if (!isset($value)) { |
|
| 240 | 240 | return; |
| 241 | 241 | } |
| 242 | 242 | |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | $relation = substr($this->column, 0, strrpos($this->column, '.')); |
| 476 | 476 | $args[0] = last(explode('.', $this->column)); |
| 477 | 477 | |
| 478 | - return ['whereHas' => [$relation, function ($relation) use ($args) { |
|
| 478 | + return ['whereHas' => [$relation, function($relation) use ($args) { |
|
| 479 | 479 | call_user_func_array([$relation, $this->query], $args); |
| 480 | 480 | }]]; |
| 481 | 481 | } |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | * |
| 39 | 39 | * @param array|callable|string $options |
| 40 | 40 | * |
| 41 | - * @return $this|mixed |
|
| 41 | + * @return Select |
|
| 42 | 42 | */ |
| 43 | 43 | public function options($options = []) |
| 44 | 44 | { |
@@ -226,12 +226,12 @@ |
||
| 226 | 226 | public function model($model, $idField = 'id', $textField = 'name') |
| 227 | 227 | { |
| 228 | 228 | if ( |
| 229 | - ! class_exists($model) |
|
| 230 | - || ! in_array(Model::class, class_parents($model)) |
|
| 229 | + !class_exists($model) |
|
| 230 | + || !in_array(Model::class, class_parents($model)) |
|
| 231 | 231 | ) { |
| 232 | 232 | throw new \InvalidArgumentException("[$model] must be a valid model class"); |
| 233 | 233 | } |
| 234 | - $this->options = function ($value) use ($model, $idField, $textField) { |
|
| 234 | + $this->options = function($value) use ($model, $idField, $textField) { |
|
| 235 | 235 | if (empty($value)) { |
| 236 | 236 | return []; |
| 237 | 237 | } |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | { |
| 79 | 79 | static::treeBoot(); |
| 80 | 80 | |
| 81 | - static::deleting(function ($model) { |
|
| 81 | + static::deleting(function($model) { |
|
| 82 | 82 | $model->roles()->detach(); |
| 83 | 83 | }); |
| 84 | 84 | } |
@@ -317,7 +317,7 @@ |
||
| 317 | 317 | * @param string $method |
| 318 | 318 | * @param array $arguments |
| 319 | 319 | * |
| 320 | - * @return bool|mixed |
|
| 320 | + * @return Field |
|
| 321 | 321 | */ |
| 322 | 322 | public function __call($method, $arguments = []) |
| 323 | 323 | { |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | */ |
| 188 | 188 | public function fields(array $fields = []) |
| 189 | 189 | { |
| 190 | - if (! Arr::isAssoc($fields)) { |
|
| 190 | + if (!Arr::isAssoc($fields)) { |
|
| 191 | 191 | $fields = array_combine($fields, $fields); |
| 192 | 192 | } |
| 193 | 193 | |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | $this->overwriteExistingField($name); |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - return tap($field, function ($field) { |
|
| 249 | + return tap($field, function($field) { |
|
| 250 | 250 | $this->fields->push($field); |
| 251 | 251 | }); |
| 252 | 252 | } |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | $this->overwriteExistingRelation($name); |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | - return tap($relation, function ($relation) { |
|
| 273 | + return tap($relation, function($relation) { |
|
| 274 | 274 | $this->relations->push($relation); |
| 275 | 275 | }); |
| 276 | 276 | } |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | $this->fields = $this->fields->filter( |
| 290 | - function (Field $field) use ($name) { |
|
| 290 | + function(Field $field) use ($name) { |
|
| 291 | 291 | return $field->getName() != $name; |
| 292 | 292 | } |
| 293 | 293 | ); |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | $this->relations = $this->relations->filter( |
| 308 | - function (Relation $relation) use ($name) { |
|
| 308 | + function(Relation $relation) use ($name) { |
|
| 309 | 309 | return $relation->getName() != $name; |
| 310 | 310 | } |
| 311 | 311 | ); |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | */ |
| 363 | 363 | public function setWidth($fieldWidth = 8, $labelWidth = 2) |
| 364 | 364 | { |
| 365 | - collect($this->fields)->each(function ($field) use ($fieldWidth, $labelWidth) { |
|
| 365 | + collect($this->fields)->each(function($field) use ($fieldWidth, $labelWidth) { |
|
| 366 | 366 | $field->each->setWidth($fieldWidth, $labelWidth); |
| 367 | 367 | }); |
| 368 | 368 | |
@@ -447,11 +447,11 @@ discard block |
||
| 447 | 447 | */ |
| 448 | 448 | protected function handleRelationField($method, $arguments) |
| 449 | 449 | { |
| 450 | - if (! method_exists($this->model, $method)) { |
|
| 450 | + if (!method_exists($this->model, $method)) { |
|
| 451 | 451 | return false; |
| 452 | 452 | } |
| 453 | 453 | |
| 454 | - if (! ($relation = $this->model->$method()) instanceof EloquentRelation) { |
|
| 454 | + if (!($relation = $this->model->$method()) instanceof EloquentRelation) { |
|
| 455 | 455 | return false; |
| 456 | 456 | } |
| 457 | 457 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | /** |
| 89 | 89 | * Get name of this column. |
| 90 | 90 | * |
| 91 | - * @return mixed |
|
| 91 | + * @return string |
|
| 92 | 92 | */ |
| 93 | 93 | public function getName() |
| 94 | 94 | { |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | /** |
| 113 | 113 | * Get label of the column. |
| 114 | 114 | * |
| 115 | - * @return mixed |
|
| 115 | + * @return string |
|
| 116 | 116 | */ |
| 117 | 117 | public function getLabel() |
| 118 | 118 | { |
@@ -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; |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | } |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | - if (! $url) { |
|
| 310 | + if (!$url) { |
|
| 311 | 311 | return ''; |
| 312 | 312 | } |
| 313 | 313 | |
@@ -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 | } |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | public function setValue(Model $model) |
| 478 | 478 | { |
| 479 | 479 | if ($this->relation) { |
| 480 | - if (! $relationValue = $model->{$this->relation}) { |
|
| 480 | + if (!$relationValue = $model->{$this->relation}) { |
|
| 481 | 481 | return $this; |
| 482 | 482 | } |
| 483 | 483 | |
@@ -545,20 +545,20 @@ discard block |
||
| 545 | 545 | $extend = $abstract; |
| 546 | 546 | } |
| 547 | 547 | |
| 548 | - if (! isset($extend)) { |
|
| 548 | + if (!isset($extend)) { |
|
| 549 | 549 | admin_warning("[$abstract] is not a valid Show field."); |
| 550 | 550 | |
| 551 | 551 | return $this; |
| 552 | 552 | } |
| 553 | 553 | |
| 554 | - if (! $extend->escape) { |
|
| 554 | + if (!$extend->escape) { |
|
| 555 | 555 | $this->unescape(); |
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | $field = $this; |
| 559 | 559 | |
| 560 | - return $this->as(function ($value) use ($extend, $field, $arguments) { |
|
| 561 | - if (! $extend->border) { |
|
| 560 | + return $this->as(function($value) use ($extend, $field, $arguments) { |
|
| 561 | + if (!$extend->border) { |
|
| 562 | 562 | $field->border = false; |
| 563 | 563 | } |
| 564 | 564 | |
@@ -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 |