@@ -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 | { |
@@ -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); |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | */ |
287 | 287 | protected function removeFilterByID($id) |
288 | 288 | { |
289 | - $this->filters = array_filter($this->filters, function (AbstractFilter $filter) use ($id) { |
|
289 | + $this->filters = array_filter($this->filters, function(AbstractFilter $filter) use ($id) { |
|
290 | 290 | return $filter->getId() != $id; |
291 | 291 | }); |
292 | 292 | } |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | { |
301 | 301 | $inputs = Arr::dot(Input::all()); |
302 | 302 | |
303 | - $inputs = array_filter($inputs, function ($input) { |
|
303 | + $inputs = array_filter($inputs, function($input) { |
|
304 | 304 | return $input !== '' && !is_null($input); |
305 | 305 | }); |
306 | 306 | |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | } |
329 | 329 | } |
330 | 330 | |
331 | - return tap(array_filter($conditions), function ($conditions) { |
|
331 | + return tap(array_filter($conditions), function($conditions) { |
|
332 | 332 | if (!empty($conditions)) { |
333 | 333 | $this->expand(); |
334 | 334 | } |
@@ -346,9 +346,9 @@ discard block |
||
346 | 346 | return $inputs; |
347 | 347 | } |
348 | 348 | |
349 | - $inputs = collect($inputs)->filter(function ($input, $key) { |
|
349 | + $inputs = collect($inputs)->filter(function($input, $key) { |
|
350 | 350 | return Str::startsWith($key, "{$this->name}_"); |
351 | - })->mapWithKeys(function ($val, $key) { |
|
351 | + })->mapWithKeys(function($val, $key) { |
|
352 | 352 | $key = str_replace("{$this->name}_", '', $key); |
353 | 353 | |
354 | 354 | return [$key => $val]; |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | */ |
419 | 419 | public function scope($key, $label = '') |
420 | 420 | { |
421 | - return tap(new Scope($key, $label), function (Scope $scope) { |
|
421 | + return tap(new Scope($key, $label), function(Scope $scope) { |
|
422 | 422 | return $this->scopes->push($scope); |
423 | 423 | }); |
424 | 424 | } |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | { |
443 | 443 | $key = request(Scope::QUERY_NAME); |
444 | 444 | |
445 | - return $this->scopes->first(function ($scope) use ($key) { |
|
445 | + return $this->scopes->first(function($scope) use ($key) { |
|
446 | 446 | return $scope->key == $key; |
447 | 447 | }); |
448 | 448 | } |
@@ -567,9 +567,9 @@ discard block |
||
567 | 567 | |
568 | 568 | $columns->push($pageKey); |
569 | 569 | |
570 | - $groupNames = collect($this->filters)->filter(function ($filter) { |
|
570 | + $groupNames = collect($this->filters)->filter(function($filter) { |
|
571 | 571 | return $filter instanceof Filter\Group; |
572 | - })->map(function (AbstractFilter $filter) { |
|
572 | + })->map(function(AbstractFilter $filter) { |
|
573 | 573 | return "{$filter->getId()}_group"; |
574 | 574 | }); |
575 | 575 |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | |
497 | 497 | $column = $this; |
498 | 498 | |
499 | - return $this->display(function ($value) use ($grid, $column, $abstract, $arguments) { |
|
499 | + return $this->display(function($value) use ($grid, $column, $abstract, $arguments) { |
|
500 | 500 | /** @var AbstractDisplayer $displayer */ |
501 | 501 | $displayer = new $abstract($value, $grid, $column, $this); |
502 | 502 | |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | */ |
515 | 515 | public function using(array $values, $default = null) |
516 | 516 | { |
517 | - return $this->display(function ($value) use ($values, $default) { |
|
517 | + return $this->display(function($value) use ($values, $default) { |
|
518 | 518 | if (is_null($value)) { |
519 | 519 | return $default; |
520 | 520 | } |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | */ |
533 | 533 | public function replace(array $replacements) |
534 | 534 | { |
535 | - return $this->display(function ($value) use ($replacements) { |
|
535 | + return $this->display(function($value) use ($replacements) { |
|
536 | 536 | if (isset($replacements[$value])) { |
537 | 537 | return $replacements[$value]; |
538 | 538 | } |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | */ |
551 | 551 | public function view($view) |
552 | 552 | { |
553 | - return $this->display(function ($value) use ($view) { |
|
553 | + return $this->display(function($value) use ($view) { |
|
554 | 554 | $model = $this; |
555 | 555 | |
556 | 556 | return view($view, compact('model', 'value'))->render(); |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | */ |
591 | 591 | public function filesize() |
592 | 592 | { |
593 | - return $this->display(function ($value) { |
|
593 | + return $this->display(function($value) { |
|
594 | 594 | return file_size($value); |
595 | 595 | }); |
596 | 596 | } |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | */ |
605 | 605 | public function gravatar($size = 30) |
606 | 606 | { |
607 | - return $this->display(function ($value) use ($size) { |
|
607 | + return $this->display(function($value) use ($size) { |
|
608 | 608 | $src = sprintf( |
609 | 609 | 'https://www.gravatar.com/avatar/%s?s=%d', |
610 | 610 | md5(strtolower($value)), |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | */ |
626 | 626 | public function loading($values = [], $others = []) |
627 | 627 | { |
628 | - return $this->display(function ($value) use ($values, $others) { |
|
628 | + return $this->display(function($value) use ($values, $others) { |
|
629 | 629 | $values = (array) $values; |
630 | 630 | |
631 | 631 | if (in_array($value, $values)) { |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | */ |
647 | 647 | public function icon(array $setting, $default = '') |
648 | 648 | { |
649 | - return $this->display(function ($value) use ($setting, $default) { |
|
649 | + return $this->display(function($value) use ($setting, $default) { |
|
650 | 650 | $fa = ''; |
651 | 651 | |
652 | 652 | if (isset($setting[$value])) { |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | Carbon::setLocale($locale); |
673 | 673 | } |
674 | 674 | |
675 | - return $this->display(function ($value) { |
|
675 | + return $this->display(function($value) { |
|
676 | 676 | return Carbon::parse($value)->diffForHumans(); |
677 | 677 | }); |
678 | 678 | } |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | */ |
687 | 687 | public function date($format) |
688 | 688 | { |
689 | - return $this->display(function ($value) use ($format) { |
|
689 | + return $this->display(function($value) use ($format) { |
|
690 | 690 | return date($format, strtotime($value)); |
691 | 691 | }); |
692 | 692 | } |
@@ -807,7 +807,7 @@ discard block |
||
807 | 807 | $grid = $this->grid; |
808 | 808 | $column = $this; |
809 | 809 | |
810 | - $this->display(function ($value) use ($grid, $column, $class) { |
|
810 | + $this->display(function($value) use ($grid, $column, $class) { |
|
811 | 811 | /** @var AbstractDisplayer $definition */ |
812 | 812 | $definition = new $class($value, $grid, $column, $this); |
813 | 813 | |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | protected function htmlEntityEncode($item) |
826 | 826 | { |
827 | 827 | if (is_array($item)) { |
828 | - array_walk_recursive($item, function (&$value) { |
|
828 | + array_walk_recursive($item, function(&$value) { |
|
829 | 829 | $value = htmlentities($value); |
830 | 830 | }); |
831 | 831 | } else { |
@@ -862,7 +862,7 @@ discard block |
||
862 | 862 | */ |
863 | 863 | protected function callSupportDisplayer($abstract, $arguments) |
864 | 864 | { |
865 | - return $this->display(function ($value) use ($abstract, $arguments) { |
|
865 | + return $this->display(function($value) use ($abstract, $arguments) { |
|
866 | 866 | if (is_array($value) || $value instanceof Arrayable) { |
867 | 867 | return call_user_func_array([collect($value), $abstract], $arguments); |
868 | 868 | } |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | protected function callBuiltinDisplayer($abstract, $arguments) |
887 | 887 | { |
888 | 888 | if ($abstract instanceof Closure) { |
889 | - return $this->display(function ($value) use ($abstract, $arguments) { |
|
889 | + return $this->display(function($value) use ($abstract, $arguments) { |
|
890 | 890 | return $abstract->call($this, ...array_merge([$value], $arguments)); |
891 | 891 | }); |
892 | 892 | } |
@@ -895,7 +895,7 @@ discard block |
||
895 | 895 | $grid = $this->grid; |
896 | 896 | $column = $this; |
897 | 897 | |
898 | - return $this->display(function ($value) use ($abstract, $grid, $column, $arguments) { |
|
898 | + return $this->display(function($value) use ($abstract, $grid, $column, $arguments) { |
|
899 | 899 | /** @var AbstractDisplayer $displayer */ |
900 | 900 | $displayer = new $abstract($value, $grid, $column, $this); |
901 | 901 |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | /** |
219 | 219 | * Set model for column. |
220 | 220 | * |
221 | - * @param $model |
|
221 | + * @param BaseModel $model |
|
222 | 222 | */ |
223 | 223 | public function setModel($model) |
224 | 224 | { |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | /** |
348 | 348 | * Get name of this column. |
349 | 349 | * |
350 | - * @return mixed |
|
350 | + * @return string |
|
351 | 351 | */ |
352 | 352 | public function getName() |
353 | 353 | { |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | /** |
386 | 386 | * Get label of the column. |
387 | 387 | * |
388 | - * @return mixed |
|
388 | + * @return string |
|
389 | 389 | */ |
390 | 390 | public function getLabel() |
391 | 391 | { |
@@ -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 | */ |
@@ -88,7 +88,7 @@ |
||
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 |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | $column = new Column($column, $label); |
358 | 358 | $column->setGrid($this); |
359 | 359 | |
360 | - return tap($column, function ($value) { |
|
360 | + return tap($column, function($value) { |
|
361 | 361 | $this->columns->push($value); |
362 | 362 | }); |
363 | 363 | } |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | $column = new Column($column, $label); |
422 | 422 | $column->setGrid($this); |
423 | 423 | |
424 | - return tap($column, function ($value) { |
|
424 | + return tap($column, function($value) { |
|
425 | 425 | $this->columns->prepend($value); |
426 | 426 | }); |
427 | 427 | } |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | |
555 | 555 | $data = $collection->toArray(); |
556 | 556 | |
557 | - $this->columns->map(function (Column $column) use (&$data) { |
|
557 | + $this->columns->map(function(Column $column) use (&$data) { |
|
558 | 558 | $data = $column->fill($data); |
559 | 559 | |
560 | 560 | $this->columnNames[] = $column->getName(); |
@@ -574,7 +574,7 @@ discard block |
||
574 | 574 | */ |
575 | 575 | protected function buildRows(array $data) |
576 | 576 | { |
577 | - $this->rows = collect($data)->map(function ($model, $number) { |
|
577 | + $this->rows = collect($data)->map(function($model, $number) { |
|
578 | 578 | return new Row($number, $model, $this->keyName); |
579 | 579 | }); |
580 | 580 |
@@ -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 |
@@ -67,7 +67,7 @@ |
||
67 | 67 | { |
68 | 68 | Admin::script($this->script()); |
69 | 69 | |
70 | - $options = $this->getOptions()->map(function ($option) { |
|
70 | + $options = $this->getOptions()->map(function($option) { |
|
71 | 71 | $selected = ($option == $this->perPage) ? 'selected' : ''; |
72 | 72 | $url = \request()->fullUrlWithQuery([$this->perPageName => $option]); |
73 | 73 |
@@ -106,7 +106,7 @@ |
||
106 | 106 | return []; |
107 | 107 | } |
108 | 108 | |
109 | - $selected = array_filter($selected, function ($value) { |
|
109 | + $selected = array_filter($selected, function($value) { |
|
110 | 110 | return !is_null($value); |
111 | 111 | }); |
112 | 112 |
@@ -57,7 +57,7 @@ |
||
57 | 57 | * @param string $column |
58 | 58 | * @param string $label |
59 | 59 | * @param array $options |
60 | - * @param null $query |
|
60 | + * @param null|\Closure $query |
|
61 | 61 | * @param string $type |
62 | 62 | * |
63 | 63 | * @return $this |