@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | * Get or set option for grid. |
| 251 | 251 | * |
| 252 | 252 | * @param string $key |
| 253 | - * @param mixed $value |
|
| 253 | + * @param boolean $value |
|
| 254 | 254 | * |
| 255 | 255 | * @return $this|mixed |
| 256 | 256 | */ |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | /** |
| 441 | 441 | * Get the grid paginator. |
| 442 | 442 | * |
| 443 | - * @return mixed |
|
| 443 | + * @return Tools\Paginator |
|
| 444 | 444 | */ |
| 445 | 445 | public function paginator() |
| 446 | 446 | { |
@@ -622,7 +622,7 @@ discard block |
||
| 622 | 622 | * |
| 623 | 623 | * @param bool $toArray |
| 624 | 624 | * |
| 625 | - * @return array|Collection|mixed |
|
| 625 | + * @return Collection |
|
| 626 | 626 | */ |
| 627 | 627 | public function processFilter($toArray = true) |
| 628 | 628 | { |
@@ -872,7 +872,7 @@ discard block |
||
| 872 | 872 | * |
| 873 | 873 | * @param Closure|null $closure |
| 874 | 874 | * |
| 875 | - * @return $this|Closure |
|
| 875 | + * @return callable |
|
| 876 | 876 | */ |
| 877 | 877 | public function header(Closure $closure = null) |
| 878 | 878 | { |
@@ -904,7 +904,7 @@ discard block |
||
| 904 | 904 | * |
| 905 | 905 | * @param Closure|null $closure |
| 906 | 906 | * |
| 907 | - * @return $this|Closure |
|
| 907 | + * @return callable |
|
| 908 | 908 | */ |
| 909 | 909 | public function footer(Closure $closure = null) |
| 910 | 910 | { |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | |
| 331 | 331 | $label = empty($label) ? ucfirst($relationColumn) : $label; |
| 332 | 332 | |
| 333 | - $name = snake_case($relationName) . '.' . $relationColumn; |
|
| 333 | + $name = snake_case($relationName).'.'.$relationColumn; |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | $column = $this->addColumn($name, $label); |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | |
| 389 | 389 | array_push($visible, '__row_selector__', '__actions__'); |
| 390 | 390 | |
| 391 | - return $this->columns->filter(function (Column $column) use ($visible) { |
|
| 391 | + return $this->columns->filter(function(Column $column) use ($visible) { |
|
| 392 | 392 | return in_array($column->getName(), $visible); |
| 393 | 393 | }); |
| 394 | 394 | } |
@@ -408,7 +408,7 @@ discard block |
||
| 408 | 408 | |
| 409 | 409 | array_push($visible, '__row_selector__', '__actions__'); |
| 410 | 410 | |
| 411 | - return collect($this->columnNames)->filter(function ($column) use ($visible) { |
|
| 411 | + return collect($this->columnNames)->filter(function($column) use ($visible) { |
|
| 412 | 412 | return in_array($column, $visible); |
| 413 | 413 | }); |
| 414 | 414 | } |
@@ -426,7 +426,7 @@ discard block |
||
| 426 | 426 | $column = new Column($column, $label); |
| 427 | 427 | $column->setGrid($this); |
| 428 | 428 | |
| 429 | - return tap($column, function ($value) { |
|
| 429 | + return tap($column, function($value) { |
|
| 430 | 430 | $this->columns->push($value); |
| 431 | 431 | }); |
| 432 | 432 | } |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | $column = new Column($column, $label); |
| 445 | 445 | $column->setGrid($this); |
| 446 | 446 | |
| 447 | - return tap($column, function ($value) { |
|
| 447 | + return tap($column, function($value) { |
|
| 448 | 448 | $this->columns->prepend($value); |
| 449 | 449 | }); |
| 450 | 450 | } |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | |
| 602 | 602 | Column::setOriginalGridModels($collection); |
| 603 | 603 | |
| 604 | - $this->columns->map(function (Column $column) use (&$data) { |
|
| 604 | + $this->columns->map(function(Column $column) use (&$data) { |
|
| 605 | 605 | $data = $column->fill($data); |
| 606 | 606 | |
| 607 | 607 | $this->columnNames[] = $column->getName(); |
@@ -705,7 +705,7 @@ discard block |
||
| 705 | 705 | */ |
| 706 | 706 | protected function buildRows(array $data) |
| 707 | 707 | { |
| 708 | - $this->rows = collect($data)->map(function ($model, $number) { |
|
| 708 | + $this->rows = collect($data)->map(function($model, $number) { |
|
| 709 | 709 | return new Row($number, $model); |
| 710 | 710 | }); |
| 711 | 711 | |
@@ -782,7 +782,7 @@ discard block |
||
| 782 | 782 | $input = array_merge($input, $constraints); |
| 783 | 783 | } |
| 784 | 784 | |
| 785 | - return $this->resource() . '?' . http_build_query($input); |
|
| 785 | + return $this->resource().'?'.http_build_query($input); |
|
| 786 | 786 | } |
| 787 | 787 | |
| 788 | 788 | /** |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | return sprintf( |
| 802 | 802 | '%s/create%s', |
| 803 | 803 | $this->resource(), |
| 804 | - $queryString ? ('?' . $queryString) : '' |
|
| 804 | + $queryString ? ('?'.$queryString) : '' |
|
| 805 | 805 | ); |
| 806 | 806 | } |
| 807 | 807 | |
@@ -112,7 +112,7 @@ |
||
| 112 | 112 | protected function startColumn() |
| 113 | 113 | { |
| 114 | 114 | // get class name using width array |
| 115 | - $classnName = collect($this->width)->map(function ($value, $key) { |
|
| 115 | + $classnName = collect($this->width)->map(function($value, $key) { |
|
| 116 | 116 | return "col-$key-$value"; |
| 117 | 117 | })->implode(' '); |
| 118 | 118 | |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | /** |
| 223 | 223 | * Field constructor. |
| 224 | 224 | * |
| 225 | - * @param $column |
|
| 225 | + * @param string $column |
|
| 226 | 226 | * @param array $arguments |
| 227 | 227 | */ |
| 228 | 228 | public function __construct($column, $arguments = []) |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | /** |
| 557 | 557 | * Set or get value of the field. |
| 558 | 558 | * |
| 559 | - * @param null $value |
|
| 559 | + * @param string $value |
|
| 560 | 560 | * |
| 561 | 561 | * @return mixed |
| 562 | 562 | */ |
@@ -727,7 +727,7 @@ discard block |
||
| 727 | 727 | /** |
| 728 | 728 | * Add html attributes to elements. |
| 729 | 729 | * |
| 730 | - * @param array|string $attribute |
|
| 730 | + * @param string $attribute |
|
| 731 | 731 | * @param mixed $value |
| 732 | 732 | * |
| 733 | 733 | * @return $this |
@@ -1019,7 +1019,7 @@ discard block |
||
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | 1021 | /** |
| 1022 | - * @param array $labelClass |
|
| 1022 | + * @param string[] $labelClass |
|
| 1023 | 1023 | * |
| 1024 | 1024 | * @return self |
| 1025 | 1025 | */ |
@@ -1072,7 +1072,7 @@ discard block |
||
| 1072 | 1072 | /** |
| 1073 | 1073 | * Set view of current field. |
| 1074 | 1074 | * |
| 1075 | - * @return string |
|
| 1075 | + * @return Field |
|
| 1076 | 1076 | */ |
| 1077 | 1077 | public function setView($view) |
| 1078 | 1078 | { |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | $this->setupScript($show, $columns); |
| 40 | 40 | |
| 41 | - $lists = $columns->map(function ($val, $key) use ($show) { |
|
| 41 | + $lists = $columns->map(function($val, $key) use ($show) { |
|
| 42 | 42 | if (empty($show)) { |
| 43 | 43 | $checked = 'checked'; |
| 44 | 44 | } else { |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | protected function getGridColumns() |
| 75 | 75 | { |
| 76 | - return $this->grid->columns()->map(function (Grid\Column $column) { |
|
| 76 | + return $this->grid->columns()->map(function(Grid\Column $column) { |
|
| 77 | 77 | $name = $column->getName(); |
| 78 | 78 | |
| 79 | 79 | if (in_array($name, ['__row_selector__', '__actions__'])) { |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function disableFilterButton(bool $disable = true) |
| 87 | 87 | { |
| 88 | - $this->tools = $this->tools->map(function (AbstractTool $tool) use ($disable) { |
|
| 88 | + $this->tools = $this->tools->map(function(AbstractTool $tool) use ($disable) { |
|
| 89 | 89 | if ($tool instanceof FilterButton) { |
| 90 | 90 | return $tool->disable($disable); |
| 91 | 91 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function disableRefreshButton(bool $disable = true) |
| 102 | 102 | { |
| 103 | - $this->tools = $this->tools->map(function (AbstractTool $tool) use ($disable) { |
|
| 103 | + $this->tools = $this->tools->map(function(AbstractTool $tool) use ($disable) { |
|
| 104 | 104 | if ($tool instanceof RefreshButton) { |
| 105 | 105 | return $tool->disable($disable); |
| 106 | 106 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | public function disableBatchActions(bool $disable = true) |
| 117 | 117 | { |
| 118 | - $this->tools = $this->tools->map(function ($tool) use ($disable) { |
|
| 118 | + $this->tools = $this->tools->map(function($tool) use ($disable) { |
|
| 119 | 119 | if ($tool instanceof BatchActions) { |
| 120 | 120 | return $tool->disable($disable); |
| 121 | 121 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | public function batch(\Closure $closure) |
| 130 | 130 | { |
| 131 | - call_user_func($closure, $this->tools->first(function ($tool) { |
|
| 131 | + call_user_func($closure, $this->tools->first(function($tool) { |
|
| 132 | 132 | return $tool instanceof BatchActions; |
| 133 | 133 | })); |
| 134 | 134 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | public function render() |
| 142 | 142 | { |
| 143 | - return $this->tools->map(function ($tool) { |
|
| 143 | + return $this->tools->map(function($tool) { |
|
| 144 | 144 | if ($tool instanceof AbstractTool) { |
| 145 | 145 | if (!$tool->allowed()) { |
| 146 | 146 | return ''; |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | */ |
| 272 | 272 | protected function removeFilterByID($id) |
| 273 | 273 | { |
| 274 | - $this->filters = array_filter($this->filters, function (AbstractFilter $filter) use ($id) { |
|
| 274 | + $this->filters = array_filter($this->filters, function(AbstractFilter $filter) use ($id) { |
|
| 275 | 275 | return $filter->getId() != $id; |
| 276 | 276 | }); |
| 277 | 277 | } |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | { |
| 286 | 286 | $inputs = array_dot(Input::all()); |
| 287 | 287 | |
| 288 | - $inputs = array_filter($inputs, function ($input) { |
|
| 288 | + $inputs = array_filter($inputs, function($input) { |
|
| 289 | 289 | return $input !== '' && !is_null($input); |
| 290 | 290 | }); |
| 291 | 291 | |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | } |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | - return tap(array_filter($conditions), function ($conditions) { |
|
| 316 | + return tap(array_filter($conditions), function($conditions) { |
|
| 317 | 317 | if (!empty($conditions)) { |
| 318 | 318 | $this->expand(); |
| 319 | 319 | } |
@@ -331,9 +331,9 @@ discard block |
||
| 331 | 331 | return $inputs; |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - $inputs = collect($inputs)->filter(function ($input, $key) { |
|
| 334 | + $inputs = collect($inputs)->filter(function($input, $key) { |
|
| 335 | 335 | return starts_with($key, "{$this->name}_"); |
| 336 | - })->mapWithKeys(function ($val, $key) { |
|
| 336 | + })->mapWithKeys(function($val, $key) { |
|
| 337 | 337 | $key = str_replace("{$this->name}_", '', $key); |
| 338 | 338 | |
| 339 | 339 | return [$key => $val]; |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | */ |
| 404 | 404 | public function scope($key, $label = '') |
| 405 | 405 | { |
| 406 | - return tap(new Scope($key, $label), function (Scope $scope) { |
|
| 406 | + return tap(new Scope($key, $label), function(Scope $scope) { |
|
| 407 | 407 | return $this->scopes->push($scope); |
| 408 | 408 | }); |
| 409 | 409 | } |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | { |
| 428 | 428 | $key = request(Scope::QUERY_NAME); |
| 429 | 429 | |
| 430 | - return $this->scopes->first(function ($scope) use ($key) { |
|
| 430 | + return $this->scopes->first(function($scope) use ($key) { |
|
| 431 | 431 | return $scope->key == $key; |
| 432 | 432 | }); |
| 433 | 433 | } |
@@ -547,9 +547,9 @@ discard block |
||
| 547 | 547 | |
| 548 | 548 | $columns->push($pageKey); |
| 549 | 549 | |
| 550 | - $groupNames = collect($this->filters)->filter(function ($filter) { |
|
| 550 | + $groupNames = collect($this->filters)->filter(function($filter) { |
|
| 551 | 551 | return $filter instanceof Group; |
| 552 | - })->map(function (AbstractFilter $filter) { |
|
| 552 | + })->map(function(AbstractFilter $filter) { |
|
| 553 | 553 | return "{$filter->getId()}_group"; |
| 554 | 554 | }); |
| 555 | 555 | |
@@ -581,17 +581,17 @@ discard block |
||
| 581 | 581 | $keys = $keys->toArray(); |
| 582 | 582 | } |
| 583 | 583 | |
| 584 | - $keys = (array)$keys; |
|
| 584 | + $keys = (array) $keys; |
|
| 585 | 585 | |
| 586 | 586 | $request = request(); |
| 587 | 587 | |
| 588 | 588 | $query = $request->query(); |
| 589 | 589 | array_forget($query, $keys); |
| 590 | 590 | |
| 591 | - $question = $request->getBaseUrl() . $request->getPathInfo() == '/' ? '/?' : '?'; |
|
| 591 | + $question = $request->getBaseUrl().$request->getPathInfo() == '/' ? '/?' : '?'; |
|
| 592 | 592 | |
| 593 | 593 | return count($request->query()) > 0 |
| 594 | - ? $request->url() . $question . http_build_query($query) |
|
| 594 | + ? $request->url().$question.http_build_query($query) |
|
| 595 | 595 | : $request->fullUrl(); |
| 596 | 596 | } |
| 597 | 597 | |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | public static function extend($name, $filterClass) |
| 603 | 603 | { |
| 604 | 604 | if (!is_subclass_of($filterClass, AbstractFilter::class)) { |
| 605 | - throw new \InvalidArgumentException("The class [$filterClass] must be a type of " . AbstractFilter::class . '.'); |
|
| 605 | + throw new \InvalidArgumentException("The class [$filterClass] must be a type of ".AbstractFilter::class.'.'); |
|
| 606 | 606 | } |
| 607 | 607 | |
| 608 | 608 | static::$supports[$name] = $filterClass; |