@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | { |
110 | 110 | if ($disable) { |
111 | 111 | array_delete($this->defaultClass, Show::class); |
112 | - } elseif (! in_array(Show::class, $this->defaultClass)) { |
|
112 | + } elseif (!in_array(Show::class, $this->defaultClass)) { |
|
113 | 113 | array_push($this->defaultClass, Show::class); |
114 | 114 | } |
115 | 115 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | { |
128 | 128 | if ($disable) { |
129 | 129 | array_delete($this->defaultClass, Delete::class); |
130 | - } elseif (! in_array(Delete::class, $this->defaultClass)) { |
|
130 | + } elseif (!in_array(Delete::class, $this->defaultClass)) { |
|
131 | 131 | array_push($this->defaultClass, Delete::class); |
132 | 132 | } |
133 | 133 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | { |
146 | 146 | if ($disable) { |
147 | 147 | array_delete($this->defaultClass, Edit::class); |
148 | - } elseif (! in_array(Edit::class, $this->defaultClass)) { |
|
148 | + } elseif (!in_array(Edit::class, $this->defaultClass)) { |
|
149 | 149 | array_push($this->defaultClass, Edit::class); |
150 | 150 | } |
151 | 151 |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | { |
83 | 83 | if ($disable) { |
84 | 84 | array_delete($this->actions, 'view'); |
85 | - } elseif (! in_array('view', $this->actions)) { |
|
85 | + } elseif (!in_array('view', $this->actions)) { |
|
86 | 86 | array_push($this->actions, 'view'); |
87 | 87 | } |
88 | 88 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | { |
99 | 99 | if ($disable) { |
100 | 100 | array_delete($this->actions, 'delete'); |
101 | - } elseif (! in_array('delete', $this->actions)) { |
|
101 | + } elseif (!in_array('delete', $this->actions)) { |
|
102 | 102 | array_push($this->actions, 'delete'); |
103 | 103 | } |
104 | 104 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | { |
115 | 115 | if ($disable) { |
116 | 116 | array_delete($this->actions, 'edit'); |
117 | - } elseif (! in_array('edit', $this->actions)) { |
|
117 | + } elseif (!in_array('edit', $this->actions)) { |
|
118 | 118 | array_push($this->actions, 'edit'); |
119 | 119 | } |
120 | 120 |
@@ -8,7 +8,7 @@ |
||
8 | 8 | { |
9 | 9 | public function display() |
10 | 10 | { |
11 | - if (! trait_exists('\Spatie\EloquentSortable\SortableTrait')) { |
|
11 | + if (!trait_exists('\Spatie\EloquentSortable\SortableTrait')) { |
|
12 | 12 | throw new \Exception('To use orderable grid, please install package [spatie/eloquent-sortable] first.'); |
13 | 13 | } |
14 | 14 |
@@ -209,11 +209,11 @@ |
||
209 | 209 | 'data-value' => "{$this->value}", |
210 | 210 | ]; |
211 | 211 | |
212 | - if (! empty($this->attributes)) { |
|
212 | + if (!empty($this->attributes)) { |
|
213 | 213 | $attributes = array_merge($attributes, $this->attributes); |
214 | 214 | } |
215 | 215 | |
216 | - $attributes = collect($attributes)->map(function ($attribute, $name) { |
|
216 | + $attributes = collect($attributes)->map(function($attribute, $name) { |
|
217 | 217 | return "$name='$attribute'"; |
218 | 218 | })->implode(' '); |
219 | 219 |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | { |
24 | 24 | $this->updateStates($states); |
25 | 25 | |
26 | - if (! Arr::isAssoc($columns)) { |
|
26 | + if (!Arr::isAssoc($columns)) { |
|
27 | 27 | $labels = array_map('ucfirst', $columns); |
28 | 28 | |
29 | 29 | $columns = array_combine($columns, $labels); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | if ($keys->isEmpty()) { |
47 | 47 | $key = $name; |
48 | 48 | } else { |
49 | - $key = $keys->shift().$keys->reduce(function ($carry, $val) { |
|
49 | + $key = $keys->shift().$keys->reduce(function($carry, $val) { |
|
50 | 50 | return $carry."[$val]"; |
51 | 51 | }); |
52 | 52 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | public function style($style) |
121 | 121 | { |
122 | 122 | if (is_array($style)) { |
123 | - $style = implode(';', array_map(function ($key, $val) { |
|
123 | + $style = implode(';', array_map(function($key, $val) { |
|
124 | 124 | return "$key:$val"; |
125 | 125 | }, array_keys($style), array_values($style))); |
126 | 126 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | $value = $value->toJson(); |
199 | 199 | } |
200 | 200 | |
201 | - if (! is_null($value) && ! is_scalar($value)) { |
|
201 | + if (!is_null($value) && !is_scalar($value)) { |
|
202 | 202 | return sprintf('<pre>%s</pre>', var_export($value, true)); |
203 | 203 | } |
204 | 204 |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | public function disableFilterButton(bool $disable = true) |
91 | 91 | { |
92 | - $this->tools = $this->tools->map(function ($tool) use ($disable) { |
|
92 | + $this->tools = $this->tools->map(function($tool) use ($disable) { |
|
93 | 93 | if ($tool instanceof FilterButton) { |
94 | 94 | return $tool->disable($disable); |
95 | 95 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function disableBatchActions(bool $disable = true) |
119 | 119 | { |
120 | - $this->tools = $this->tools->map(function ($tool) use ($disable) { |
|
120 | + $this->tools = $this->tools->map(function($tool) use ($disable) { |
|
121 | 121 | if ($tool instanceof BatchActions) { |
122 | 122 | return $tool->disable($disable); |
123 | 123 | } |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function batch(\Closure $closure) |
133 | 133 | { |
134 | - call_user_func($closure, $this->tools->first(function ($tool) { |
|
134 | + call_user_func($closure, $this->tools->first(function($tool) { |
|
135 | 135 | return $tool instanceof BatchActions; |
136 | 136 | })); |
137 | 137 | } |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public function render() |
145 | 145 | { |
146 | - return $this->tools->map(function ($tool) { |
|
146 | + return $this->tools->map(function($tool) { |
|
147 | 147 | if ($tool instanceof AbstractTool) { |
148 | - if (! $tool->allowed()) { |
|
148 | + if (!$tool->allowed()) { |
|
149 | 149 | return ''; |
150 | 150 | } |
151 | 151 |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | $name = $this->getName(); |
489 | 489 | $query = request()->query(); |
490 | 490 | |
491 | - $this->prefix(function ($_, $original) use ($name, $query) { |
|
491 | + $this->prefix(function($_, $original) use ($name, $query) { |
|
492 | 492 | Arr::set($query, $name, $original); |
493 | 493 | |
494 | 494 | $url = request()->fullUrlWithQuery($query); |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | */ |
507 | 507 | public function bindSearchQuery(Model $model) |
508 | 508 | { |
509 | - if (! $this->searchable || ! request()->has($this->getName())) { |
|
509 | + if (!$this->searchable || !request()->has($this->getName())) { |
|
510 | 510 | return; |
511 | 511 | } |
512 | 512 | |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | |
542 | 542 | $column = $this; |
543 | 543 | |
544 | - return $this->display(function ($value) use ($grid, $column, $abstract, $arguments) { |
|
544 | + return $this->display(function($value) use ($grid, $column, $abstract, $arguments) { |
|
545 | 545 | /** @var AbstractDisplayer $displayer */ |
546 | 546 | $displayer = new $abstract($value, $grid, $column, $this); |
547 | 547 | |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | */ |
560 | 560 | public function using(array $values, $default = null) |
561 | 561 | { |
562 | - return $this->display(function ($value) use ($values, $default) { |
|
562 | + return $this->display(function($value) use ($values, $default) { |
|
563 | 563 | if (is_null($value)) { |
564 | 564 | return $default; |
565 | 565 | } |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | */ |
578 | 578 | public function replace(array $replacements) |
579 | 579 | { |
580 | - return $this->display(function ($value) use ($replacements) { |
|
580 | + return $this->display(function($value) use ($replacements) { |
|
581 | 581 | if (isset($replacements[$value])) { |
582 | 582 | return $replacements[$value]; |
583 | 583 | } |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | */ |
596 | 596 | public function view($view) |
597 | 597 | { |
598 | - return $this->display(function ($value) use ($view) { |
|
598 | + return $this->display(function($value) use ($view) { |
|
599 | 599 | $model = $this; |
600 | 600 | |
601 | 601 | return view($view, compact('model', 'value'))->render(); |
@@ -705,7 +705,7 @@ discard block |
||
705 | 705 | */ |
706 | 706 | public function filesize() |
707 | 707 | { |
708 | - return $this->display(function ($value) { |
|
708 | + return $this->display(function($value) { |
|
709 | 709 | return file_size($value); |
710 | 710 | }); |
711 | 711 | } |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | */ |
720 | 720 | public function gravatar($size = 30) |
721 | 721 | { |
722 | - return $this->display(function ($value) use ($size) { |
|
722 | + return $this->display(function($value) use ($size) { |
|
723 | 723 | $src = sprintf( |
724 | 724 | 'https://www.gravatar.com/avatar/%s?s=%d', |
725 | 725 | md5(strtolower($value)), |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | */ |
741 | 741 | public function loading($values = [], $others = []) |
742 | 742 | { |
743 | - return $this->display(function ($value) use ($values, $others) { |
|
743 | + return $this->display(function($value) use ($values, $others) { |
|
744 | 744 | $values = (array) $values; |
745 | 745 | |
746 | 746 | if (in_array($value, $values)) { |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | */ |
762 | 762 | public function icon(array $setting, $default = '') |
763 | 763 | { |
764 | - return $this->display(function ($value) use ($setting, $default) { |
|
764 | + return $this->display(function($value) use ($setting, $default) { |
|
765 | 765 | $fa = ''; |
766 | 766 | |
767 | 767 | if (isset($setting[$value])) { |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | Carbon::setLocale($locale); |
788 | 788 | } |
789 | 789 | |
790 | - return $this->display(function ($value) { |
|
790 | + return $this->display(function($value) { |
|
791 | 791 | return Carbon::parse($value)->diffForHumans(); |
792 | 792 | }); |
793 | 793 | } |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | */ |
802 | 802 | public function date($format) |
803 | 803 | { |
804 | - return $this->display(function ($value) use ($format) { |
|
804 | + return $this->display(function($value) use ($format) { |
|
805 | 805 | return date($format, strtotime($value)); |
806 | 806 | }); |
807 | 807 | } |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | */ |
817 | 817 | public function bool(array $map = [], $default = false) |
818 | 818 | { |
819 | - return $this->display(function ($value) use ($map, $default) { |
|
819 | + return $this->display(function($value) use ($map, $default) { |
|
820 | 820 | $bool = empty($map) ? boolval($value) : Arr::get($map, $value, $default); |
821 | 821 | |
822 | 822 | return $bool ? '<i class="fa fa-check text-green"></i>' : '<i class="fa fa-close text-red"></i>'; |
@@ -832,13 +832,13 @@ discard block |
||
832 | 832 | */ |
833 | 833 | public function action($action) |
834 | 834 | { |
835 | - if (! is_subclass_of($action, RowAction::class)) { |
|
835 | + if (!is_subclass_of($action, RowAction::class)) { |
|
836 | 836 | throw new \InvalidArgumentException("Action class [$action] must be sub-class of [Encore\Admin\Actions\GridAction]"); |
837 | 837 | } |
838 | 838 | |
839 | 839 | $grid = $this->grid; |
840 | 840 | |
841 | - return $this->display(function ($_, $column) use ($action, $grid) { |
|
841 | + return $this->display(function($_, $column) use ($action, $grid) { |
|
842 | 842 | /** @var RowAction $action */ |
843 | 843 | $action = new $action(); |
844 | 844 | |
@@ -860,7 +860,7 @@ discard block |
||
860 | 860 | */ |
861 | 861 | public function dot($options = [], $default = '') |
862 | 862 | { |
863 | - return $this->prefix(function ($_, $original) use ($options, $default) { |
|
863 | + return $this->prefix(function($_, $original) use ($options, $default) { |
|
864 | 864 | if (is_null($original)) { |
865 | 865 | $style = $default; |
866 | 866 | } else { |
@@ -878,7 +878,7 @@ discard block |
||
878 | 878 | */ |
879 | 879 | protected function hasDisplayCallbacks() |
880 | 880 | { |
881 | - return ! empty($this->displayCallbacks); |
|
881 | + return !empty($this->displayCallbacks); |
|
882 | 882 | } |
883 | 883 | |
884 | 884 | /** |
@@ -980,14 +980,14 @@ discard block |
||
980 | 980 | return; |
981 | 981 | } |
982 | 982 | |
983 | - if (! class_exists($class) || ! is_subclass_of($class, AbstractDisplayer::class)) { |
|
983 | + if (!class_exists($class) || !is_subclass_of($class, AbstractDisplayer::class)) { |
|
984 | 984 | throw new \Exception("Invalid column definition [$class]"); |
985 | 985 | } |
986 | 986 | |
987 | 987 | $grid = $this->grid; |
988 | 988 | $column = $this; |
989 | 989 | |
990 | - $this->display(function ($value) use ($grid, $column, $class) { |
|
990 | + $this->display(function($value) use ($grid, $column, $class) { |
|
991 | 991 | /** @var AbstractDisplayer $definition */ |
992 | 992 | $definition = new $class($value, $grid, $column, $this); |
993 | 993 | |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | protected function htmlEntityEncode($item) |
1006 | 1006 | { |
1007 | 1007 | if (is_array($item)) { |
1008 | - array_walk_recursive($item, function (&$value) { |
|
1008 | + array_walk_recursive($item, function(&$value) { |
|
1009 | 1009 | $value = htmlentities($value); |
1010 | 1010 | }); |
1011 | 1011 | } else { |
@@ -1042,7 +1042,7 @@ discard block |
||
1042 | 1042 | */ |
1043 | 1043 | protected function callSupportDisplayer($abstract, $arguments) |
1044 | 1044 | { |
1045 | - return $this->display(function ($value) use ($abstract, $arguments) { |
|
1045 | + return $this->display(function($value) use ($abstract, $arguments) { |
|
1046 | 1046 | if (is_array($value) || $value instanceof Arrayable) { |
1047 | 1047 | return call_user_func_array([collect($value), $abstract], $arguments); |
1048 | 1048 | } |
@@ -1066,7 +1066,7 @@ discard block |
||
1066 | 1066 | protected function callBuiltinDisplayer($abstract, $arguments) |
1067 | 1067 | { |
1068 | 1068 | if ($abstract instanceof Closure) { |
1069 | - return $this->display(function ($value) use ($abstract, $arguments) { |
|
1069 | + return $this->display(function($value) use ($abstract, $arguments) { |
|
1070 | 1070 | return $abstract->call($this, ...array_merge([$value], $arguments)); |
1071 | 1071 | }); |
1072 | 1072 | } |
@@ -1075,7 +1075,7 @@ discard block |
||
1075 | 1075 | $grid = $this->grid; |
1076 | 1076 | $column = $this; |
1077 | 1077 | |
1078 | - return $this->display(function ($value) use ($abstract, $grid, $column, $arguments) { |
|
1078 | + return $this->display(function($value) use ($abstract, $grid, $column, $arguments) { |
|
1079 | 1079 | /** @var AbstractDisplayer $displayer */ |
1080 | 1080 | $displayer = new $abstract($value, $grid, $column, $this); |
1081 | 1081 | |
@@ -1098,7 +1098,7 @@ discard block |
||
1098 | 1098 | */ |
1099 | 1099 | public function __call($method, $arguments) |
1100 | 1100 | { |
1101 | - if ($this->isRelation() && ! $this->relationColumn) { |
|
1101 | + if ($this->isRelation() && !$this->relationColumn) { |
|
1102 | 1102 | $this->name = "{$this->relation}.$method"; |
1103 | 1103 | $this->label = $this->formatLabel($arguments[0] ?? null); |
1104 | 1104 |
@@ -331,9 +331,9 @@ discard block |
||
331 | 331 | |
332 | 332 | $this->setSort(); |
333 | 333 | |
334 | - $this->queries->reject(function ($query) { |
|
334 | + $this->queries->reject(function($query) { |
|
335 | 335 | return $query['method'] == 'paginate'; |
336 | - })->each(function ($query) { |
|
336 | + })->each(function($query) { |
|
337 | 337 | $this->model = $this->model->{$query['method']}(...$query['arguments']); |
338 | 338 | }); |
339 | 339 | |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | $this->setSort(); |
385 | 385 | $this->setPaginate(); |
386 | 386 | |
387 | - $this->queries->unique()->each(function ($query) { |
|
387 | + $this->queries->unique()->each(function($query) { |
|
388 | 388 | $this->model = call_user_func_array([$this->model, $query['method']], $query['arguments']); |
389 | 389 | }); |
390 | 390 | |
@@ -414,9 +414,9 @@ discard block |
||
414 | 414 | |
415 | 415 | $queryBuilder = $this->originalModel; |
416 | 416 | |
417 | - $this->queries->reject(function ($query) { |
|
417 | + $this->queries->reject(function($query) { |
|
418 | 418 | return in_array($query['method'], ['get', 'paginate']); |
419 | - })->each(function ($query) use (&$queryBuilder) { |
|
419 | + })->each(function($query) use (&$queryBuilder) { |
|
420 | 420 | $queryBuilder = $queryBuilder->{$query['method']}(...$query['arguments']); |
421 | 421 | }); |
422 | 422 | |
@@ -450,11 +450,11 @@ discard block |
||
450 | 450 | { |
451 | 451 | $paginate = $this->findQueryByMethod('paginate'); |
452 | 452 | |
453 | - $this->queries = $this->queries->reject(function ($query) { |
|
453 | + $this->queries = $this->queries->reject(function($query) { |
|
454 | 454 | return $query['method'] == 'paginate'; |
455 | 455 | }); |
456 | 456 | |
457 | - if (! $this->usePaginate) { |
|
457 | + if (!$this->usePaginate) { |
|
458 | 458 | $query = [ |
459 | 459 | 'method' => 'get', |
460 | 460 | 'arguments' => [], |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | */ |
509 | 509 | protected function findQueryByMethod($method) |
510 | 510 | { |
511 | - return $this->queries->first(function ($query) use ($method) { |
|
511 | + return $this->queries->first(function($query) use ($method) { |
|
512 | 512 | return $query['method'] == $method; |
513 | 513 | }); |
514 | 514 | } |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | protected function setSort() |
522 | 522 | { |
523 | 523 | $this->sort = \request($this->sortName, []); |
524 | - if (! is_array($this->sort)) { |
|
524 | + if (!is_array($this->sort)) { |
|
525 | 525 | return; |
526 | 526 | } |
527 | 527 | |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | } |
532 | 532 | |
533 | 533 | $columnNameContainsDots = Str::contains($columnName, '.'); |
534 | - $isRelation = $this->queries->contains(function ($query) use ($columnName) { |
|
534 | + $isRelation = $this->queries->contains(function($query) use ($columnName) { |
|
535 | 535 | return $query['method'] === 'with' && in_array($columnName, $query['arguments'], true); |
536 | 536 | }); |
537 | 537 | if ($columnNameContainsDots === true && $isRelation) { |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | } |
550 | 550 | |
551 | 551 | // get column. if contains "cast", set set column as cast |
552 | - if (! empty($this->sort['cast'])) { |
|
552 | + if (!empty($this->sort['cast'])) { |
|
553 | 553 | $column = "CAST({$columnName} AS {$this->sort['cast']}) {$this->sort['type']}"; |
554 | 554 | $method = 'orderByRaw'; |
555 | 555 | $arguments = [$column]; |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | { |
578 | 578 | [$relationName, $relationColumn] = explode('.', $column); |
579 | 579 | |
580 | - if ($this->queries->contains(function ($query) use ($relationName) { |
|
580 | + if ($this->queries->contains(function($query) use ($relationName) { |
|
581 | 581 | return $query['method'] == 'with' && in_array($relationName, $query['arguments']); |
582 | 582 | })) { |
583 | 583 | $relation = $this->model->$relationName(); |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | */ |
612 | 612 | public function resetOrderBy() |
613 | 613 | { |
614 | - $this->queries = $this->queries->reject(function ($query) { |
|
614 | + $this->queries = $this->queries->reject(function($query) { |
|
615 | 615 | return $query['method'] == 'orderBy' || $query['method'] == 'orderByDesc'; |
616 | 616 | }); |
617 | 617 | } |