@@ -13,7 +13,7 @@ |
||
| 13 | 13 | $this->value = $this->value->toArray(); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | - return collect((array) $this->value)->filter()->map(function ($value) use ($server) { |
|
| 16 | + return collect((array) $this->value)->filter()->map(function($value) use ($server) { |
|
| 17 | 17 | if (empty($value)) { |
| 18 | 18 | return ''; |
| 19 | 19 | } |
@@ -15,6 +15,9 @@ |
||
| 15 | 15 | |
| 16 | 16 | protected $format = 'YYYY-MM-DD'; |
| 17 | 17 | |
| 18 | + /** |
|
| 19 | + * @param string $format |
|
| 20 | + */ |
|
| 18 | 21 | public function format($format) |
| 19 | 22 | { |
| 20 | 23 | $this->format = $format; |
@@ -177,7 +177,7 @@ |
||
| 177 | 177 | /** |
| 178 | 178 | * @param \Exception $exception |
| 179 | 179 | * |
| 180 | - * @return mixed |
|
| 180 | + * @return Response |
|
| 181 | 181 | */ |
| 182 | 182 | public static function withException(\Exception $exception) |
| 183 | 183 | { |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function toastr() |
| 60 | 60 | { |
| 61 | - if (! $this->plugin instanceof Toastr) { |
|
| 61 | + if (!$this->plugin instanceof Toastr) { |
|
| 62 | 62 | $this->plugin = new Toastr(); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function swal() |
| 72 | 72 | { |
| 73 | - if (! $this->plugin instanceof SweatAlert2) { |
|
| 73 | + if (!$this->plugin instanceof SweatAlert2) { |
|
| 74 | 74 | $this->plugin = new SweatAlert2(); |
| 75 | 75 | } |
| 76 | 76 | |
@@ -161,7 +161,7 @@ |
||
| 161 | 161 | * @param array $replace |
| 162 | 162 | * @param string $locale |
| 163 | 163 | * |
| 164 | - * @return \Illuminate\Contracts\Translation\Translator|string|array|null |
|
| 164 | + * @return string|null |
|
| 165 | 165 | */ |
| 166 | 166 | function admin_trans($key = null, $replace = [], $locale = null) |
| 167 | 167 | { |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | use Illuminate\Support\MessageBag; |
| 4 | 4 | |
| 5 | -if (! function_exists('admin_path')) { |
|
| 5 | +if (!function_exists('admin_path')) { |
|
| 6 | 6 | |
| 7 | 7 | /** |
| 8 | 8 | * Get admin path. |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | } |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | -if (! function_exists('admin_url')) { |
|
| 20 | +if (!function_exists('admin_url')) { |
|
| 21 | 21 | /** |
| 22 | 22 | * Get admin url. |
| 23 | 23 | * |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | -if (! function_exists('admin_base_path')) { |
|
| 42 | +if (!function_exists('admin_base_path')) { |
|
| 43 | 43 | /** |
| 44 | 44 | * Get admin url. |
| 45 | 45 | * |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | -if (! function_exists('admin_toastr')) { |
|
| 66 | +if (!function_exists('admin_toastr')) { |
|
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * Flash a toastr message bag to session. |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | -if (! function_exists('admin_success')) { |
|
| 83 | +if (!function_exists('admin_success')) { |
|
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | 86 | * Flash a success message bag to session. |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | -if (! function_exists('admin_error')) { |
|
| 97 | +if (!function_exists('admin_error')) { |
|
| 98 | 98 | |
| 99 | 99 | /** |
| 100 | 100 | * Flash a error message bag to session. |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | -if (! function_exists('admin_warning')) { |
|
| 111 | +if (!function_exists('admin_warning')) { |
|
| 112 | 112 | |
| 113 | 113 | /** |
| 114 | 114 | * Flash a warning message bag to session. |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | -if (! function_exists('admin_info')) { |
|
| 125 | +if (!function_exists('admin_info')) { |
|
| 126 | 126 | |
| 127 | 127 | /** |
| 128 | 128 | * Flash a message bag to session. |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | -if (! function_exists('admin_asset')) { |
|
| 142 | +if (!function_exists('admin_asset')) { |
|
| 143 | 143 | |
| 144 | 144 | /** |
| 145 | 145 | * @param $path |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | -if (! function_exists('admin_trans')) { |
|
| 155 | +if (!function_exists('admin_trans')) { |
|
| 156 | 156 | |
| 157 | 157 | /** |
| 158 | 158 | * Translate the given message. |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | { |
| 168 | 168 | $line = __($key, $replace, $locale); |
| 169 | 169 | |
| 170 | - if (! is_string($line)) { |
|
| 170 | + if (!is_string($line)) { |
|
| 171 | 171 | return $key; |
| 172 | 172 | } |
| 173 | 173 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | } |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | -if (! function_exists('array_delete')) { |
|
| 178 | +if (!function_exists('array_delete')) { |
|
| 179 | 179 | |
| 180 | 180 | /** |
| 181 | 181 | * Delete from array by value. |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | -if (! function_exists('class_uses_deep')) { |
|
| 196 | +if (!function_exists('class_uses_deep')) { |
|
| 197 | 197 | |
| 198 | 198 | /** |
| 199 | 199 | * To get ALL traits including those used by parent classes and other traits. |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | -if (! function_exists('admin_dump')) { |
|
| 222 | +if (!function_exists('admin_dump')) { |
|
| 223 | 223 | |
| 224 | 224 | /** |
| 225 | 225 | * @param $var |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | |
| 243 | -if (! function_exists('file_size')) { |
|
| 243 | +if (!function_exists('file_size')) { |
|
| 244 | 244 | |
| 245 | 245 | /** |
| 246 | 246 | * Convert file size to a human readable format like `100mb`. |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | } |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | -if (! function_exists('prepare_options')) { |
|
| 274 | +if (!function_exists('prepare_options')) { |
|
| 275 | 275 | |
| 276 | 276 | /** |
| 277 | 277 | * @param array $options |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | } |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | -if (! function_exists('json_encode_options')) { |
|
| 303 | +if (!function_exists('json_encode_options')) { |
|
| 304 | 304 | |
| 305 | 305 | /** |
| 306 | 306 | * @param array $options |
@@ -78,7 +78,7 @@ |
||
| 78 | 78 | { |
| 79 | 79 | $this->grid->setView($this->view); |
| 80 | 80 | |
| 81 | - return function (Grid $grid) { |
|
| 81 | + return function(Grid $grid) { |
|
| 82 | 82 | if ($this->head > 0) { |
| 83 | 83 | $this->left = $grid->visibleColumns()->slice(0, $this->head); |
| 84 | 84 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | /** |
| 123 | 123 | * @param string $prefix |
| 124 | 124 | * |
| 125 | - * @return mixed|string |
|
| 125 | + * @return string |
|
| 126 | 126 | */ |
| 127 | 127 | public function selector($prefix) |
| 128 | 128 | { |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /** |
| 215 | - * @return mixed |
|
| 215 | + * @return string |
|
| 216 | 216 | */ |
| 217 | 217 | public function getCalledClass() |
| 218 | 218 | { |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | /** |
| 406 | - * @return mixed |
|
| 406 | + * @return string |
|
| 407 | 407 | */ |
| 408 | 408 | public function render() |
| 409 | 409 | { |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | public static function makeSelector($class, $prefix) |
| 142 | 142 | { |
| 143 | - if (! isset(static::$selectors[$class])) { |
|
| 143 | + if (!isset(static::$selectors[$class])) { |
|
| 144 | 144 | static::$selectors[$class] = uniqid($prefix).mt_rand(1000, 9999); |
| 145 | 145 | } |
| 146 | 146 | |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | */ |
| 262 | 262 | protected function addScript() |
| 263 | 263 | { |
| 264 | - if (! is_null($this->interactor)) { |
|
| 264 | + if (!is_null($this->interactor)) { |
|
| 265 | 265 | return $this->interactor->addScript(); |
| 266 | 266 | } |
| 267 | 267 | |
@@ -34,6 +34,9 @@ |
||
| 34 | 34 | $this->fields = Collection::make(); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | + /** |
|
| 38 | + * @param string $placeholder |
|
| 39 | + */ |
|
| 37 | 40 | protected function formatPlaceholder($placeholder) |
| 38 | 41 | { |
| 39 | 42 | return array_filter((array) $placeholder); |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | /** |
| 25 | 25 | * Set grid action callback. |
| 26 | 26 | * |
| 27 | - * @param Closure|string $actions |
|
| 27 | + * @param Closure $actions |
|
| 28 | 28 | * |
| 29 | 29 | * @return $this |
| 30 | 30 | */ |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | */ |
| 77 | 77 | public function disableActions(bool $disable = true) |
| 78 | 78 | { |
| 79 | - return $this->option('show_actions', ! $disable); |
|
| 79 | + return $this->option('show_actions', !$disable); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function batchActions(Closure $closure) |
| 90 | 90 | { |
| 91 | - $this->tools(function (Grid\Tools $tools) use ($closure) { |
|
| 91 | + $this->tools(function(Grid\Tools $tools) use ($closure) { |
|
| 92 | 92 | $tools->batch($closure); |
| 93 | 93 | }); |
| 94 | 94 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | { |
| 105 | 105 | $this->tools->disableBatchActions($disable); |
| 106 | 106 | |
| 107 | - return $this->option('show_row_selector', ! $disable); |
|
| 107 | + return $this->option('show_row_selector', !$disable); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | protected function appendActionsColumn() |
| 116 | 116 | { |
| 117 | - if (! $this->option('show_actions')) { |
|
| 117 | + if (!$this->option('show_actions')) { |
|
| 118 | 118 | return; |
| 119 | 119 | } |
| 120 | 120 | |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | * Get or set option for grid. |
| 270 | 270 | * |
| 271 | 271 | * @param string $key |
| 272 | - * @param mixed $value |
|
| 272 | + * @param boolean $value |
|
| 273 | 273 | * |
| 274 | 274 | * @return $this|mixed |
| 275 | 275 | */ |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | /** |
| 455 | 455 | * Get the grid paginator. |
| 456 | 456 | * |
| 457 | - * @return mixed |
|
| 457 | + * @return Tools\Paginator |
|
| 458 | 458 | */ |
| 459 | 459 | public function paginator() |
| 460 | 460 | { |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | /** |
| 535 | - * @return array|Collection|mixed |
|
| 535 | + * @return Collection |
|
| 536 | 536 | */ |
| 537 | 537 | protected function applyQuery() |
| 538 | 538 | { |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | /** |
| 830 | 830 | * Dynamically add columns to the grid view. |
| 831 | 831 | * |
| 832 | - * @param $method |
|
| 832 | + * @param string $method |
|
| 833 | 833 | * @param $arguments |
| 834 | 834 | * |
| 835 | 835 | * @return Column |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | */ |
| 236 | 236 | protected function handleExportRequest($forceExport = false) |
| 237 | 237 | { |
| 238 | - if (! $scope = request(Exporter::$queryName)) { |
|
| 238 | + if (!$scope = request(Exporter::$queryName)) { |
|
| 239 | 239 | return; |
| 240 | 240 | } |
| 241 | 241 | |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | $column = new Column($column, $label); |
| 361 | 361 | $column->setGrid($this); |
| 362 | 362 | |
| 363 | - return tap($column, function ($value) { |
|
| 363 | + return tap($column, function($value) { |
|
| 364 | 364 | $this->columns->push($value); |
| 365 | 365 | }); |
| 366 | 366 | } |
@@ -379,7 +379,7 @@ discard block |
||
| 379 | 379 | |
| 380 | 380 | $model = $this->model()->eloquent(); |
| 381 | 381 | |
| 382 | - if (! method_exists($model, $relation) || ! $model->{$relation}() instanceof Relations\Relation) { |
|
| 382 | + if (!method_exists($model, $relation) || !$model->{$relation}() instanceof Relations\Relation) { |
|
| 383 | 383 | $class = get_class($model); |
| 384 | 384 | |
| 385 | 385 | admin_error("Call to undefined relationship [{$relation}] on model [{$class}]."); |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | $column = new Column($column, $label); |
| 425 | 425 | $column->setGrid($this); |
| 426 | 426 | |
| 427 | - return tap($column, function ($value) { |
|
| 427 | + return tap($column, function($value) { |
|
| 428 | 428 | $this->columns->prepend($value); |
| 429 | 429 | }); |
| 430 | 430 | } |
@@ -470,9 +470,9 @@ discard block |
||
| 470 | 470 | */ |
| 471 | 471 | public function disablePagination(bool $disable = true) |
| 472 | 472 | { |
| 473 | - $this->model->usePaginate(! $disable); |
|
| 473 | + $this->model->usePaginate(!$disable); |
|
| 474 | 474 | |
| 475 | - return $this->option('show_pagination', ! $disable); |
|
| 475 | + return $this->option('show_pagination', !$disable); |
|
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | /** |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | */ |
| 513 | 513 | protected function prependRowSelectorColumn() |
| 514 | 514 | { |
| 515 | - if (! $this->option('show_row_selector')) { |
|
| 515 | + if (!$this->option('show_row_selector')) { |
|
| 516 | 516 | return; |
| 517 | 517 | } |
| 518 | 518 | |
@@ -590,7 +590,7 @@ discard block |
||
| 590 | 590 | |
| 591 | 591 | $data = $collection->toArray(); |
| 592 | 592 | |
| 593 | - $this->columns->map(function (Column $column) use (&$data) { |
|
| 593 | + $this->columns->map(function(Column $column) use (&$data) { |
|
| 594 | 594 | $data = $column->fill($data); |
| 595 | 595 | |
| 596 | 596 | $this->columnNames[] = $column->getName(); |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | */ |
| 611 | 611 | protected function buildRows(array $data) |
| 612 | 612 | { |
| 613 | - $this->rows = collect($data)->map(function ($model, $number) { |
|
| 613 | + $this->rows = collect($data)->map(function($model, $number) { |
|
| 614 | 614 | return new Row($number, $model, $this->keyName); |
| 615 | 615 | }); |
| 616 | 616 | |
@@ -705,7 +705,7 @@ discard block |
||
| 705 | 705 | */ |
| 706 | 706 | public function disableExport(bool $disable = true) |
| 707 | 707 | { |
| 708 | - return $this->option('show_exporter', ! $disable); |
|
| 708 | + return $this->option('show_exporter', !$disable); |
|
| 709 | 709 | } |
| 710 | 710 | |
| 711 | 711 | /** |
@@ -737,7 +737,7 @@ discard block |
||
| 737 | 737 | */ |
| 738 | 738 | public function disableCreateButton(bool $disable = true) |
| 739 | 739 | { |
| 740 | - return $this->option('show_create_btn', ! $disable); |
|
| 740 | + return $this->option('show_create_btn', !$disable); |
|
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | /** |
@@ -747,7 +747,7 @@ discard block |
||
| 747 | 747 | */ |
| 748 | 748 | public function disableDefineEmptyPage(bool $disable = true) |
| 749 | 749 | { |
| 750 | - return $this->option('show_define_empty_page', ! $disable); |
|
| 750 | + return $this->option('show_define_empty_page', !$disable); |
|
| 751 | 751 | } |
| 752 | 752 | |
| 753 | 753 | /** |
@@ -789,13 +789,13 @@ discard block |
||
| 789 | 789 | */ |
| 790 | 790 | public function resource($path = null) |
| 791 | 791 | { |
| 792 | - if (! empty($path)) { |
|
| 792 | + if (!empty($path)) { |
|
| 793 | 793 | $this->resourcePath = $path; |
| 794 | 794 | |
| 795 | 795 | return $this; |
| 796 | 796 | } |
| 797 | 797 | |
| 798 | - if (! empty($this->resourcePath)) { |
|
| 798 | + if (!empty($this->resourcePath)) { |
|
| 799 | 799 | return $this->resourcePath; |
| 800 | 800 | } |
| 801 | 801 | |
@@ -831,11 +831,11 @@ discard block |
||
| 831 | 831 | { |
| 832 | 832 | $model = $this->model()->eloquent(); |
| 833 | 833 | |
| 834 | - if (! method_exists($model, $method)) { |
|
| 834 | + if (!method_exists($model, $method)) { |
|
| 835 | 835 | return false; |
| 836 | 836 | } |
| 837 | 837 | |
| 838 | - if (! ($relation = $model->$method()) instanceof Relations\Relation) { |
|
| 838 | + if (!($relation = $model->$method()) instanceof Relations\Relation) { |
|
| 839 | 839 | return false; |
| 840 | 840 | } |
| 841 | 841 | |
@@ -931,7 +931,7 @@ discard block |
||
| 931 | 931 | */ |
| 932 | 932 | public function setView($view, $variables = []) |
| 933 | 933 | { |
| 934 | - if (! empty($variables)) { |
|
| 934 | + if (!empty($variables)) { |
|
| 935 | 935 | $this->with($variables); |
| 936 | 936 | } |
| 937 | 937 | |