@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace Encore\Admin\Form; |
4 | 4 | |
5 | -use Encore\Admin\Form; |
|
5 | +use Encore\Admin\Form; |
|
6 | 6 | use Illuminate\Contracts\Support\Renderable; |
7 | 7 | |
8 | 8 | class Row implements Renderable |
@@ -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 | { |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | } |
543 | 543 | |
544 | 544 | /** |
545 | - * @return array|Collection|mixed |
|
545 | + * @return Collection |
|
546 | 546 | */ |
547 | 547 | protected function applyQuery() |
548 | 548 | { |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | /** |
862 | 862 | * Dynamically add columns to the grid view. |
863 | 863 | * |
864 | - * @param $method |
|
864 | + * @param string $method |
|
865 | 865 | * @param $arguments |
866 | 866 | * |
867 | 867 | * @return Column |
@@ -2,21 +2,21 @@ |
||
2 | 2 | |
3 | 3 | namespace Encore\Admin; |
4 | 4 | |
5 | -use Closure; |
|
6 | -use Encore\Admin\Exception\Handler; |
|
7 | -use Encore\Admin\Grid\Column; |
|
8 | -use Encore\Admin\Grid\Concerns; |
|
9 | -use Encore\Admin\Grid\Displayers; |
|
10 | -use Encore\Admin\Grid\Exporter; |
|
11 | -use Encore\Admin\Grid\Exporters\AbstractExporter; |
|
12 | -use Encore\Admin\Grid\Model; |
|
13 | -use Encore\Admin\Grid\Row; |
|
14 | -use Encore\Admin\Grid\Tools; |
|
15 | -use Illuminate\Database\Eloquent\Model as Eloquent; |
|
16 | -use Illuminate\Database\Eloquent\Relations; |
|
17 | -use Illuminate\Support\Collection; |
|
18 | -use Illuminate\Support\Str; |
|
19 | -use Illuminate\Support\Traits\Macroable; |
|
5 | +use Closure; |
|
6 | +use Encore\Admin\Exception\Handler; |
|
7 | +use Encore\Admin\Grid\Column; |
|
8 | +use Encore\Admin\Grid\Concerns; |
|
9 | +use Encore\Admin\Grid\Displayers; |
|
10 | +use Encore\Admin\Grid\Exporter; |
|
11 | +use Encore\Admin\Grid\Exporters\AbstractExporter; |
|
12 | +use Encore\Admin\Grid\Model; |
|
13 | +use Encore\Admin\Grid\Row; |
|
14 | +use Encore\Admin\Grid\Tools; |
|
15 | +use Illuminate\Database\Eloquent\Model as Eloquent; |
|
16 | +use Illuminate\Database\Eloquent\Relations; |
|
17 | +use Illuminate\Support\Collection; |
|
18 | +use Illuminate\Support\Str; |
|
19 | +use Illuminate\Support\Traits\Macroable; |
|
20 | 20 | use Jenssegers\Mongodb\Eloquent\Model as MongodbModel; |
21 | 21 | |
22 | 22 | class Grid |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | $column = new Column($column, $label); |
359 | 359 | $column->setGrid($this); |
360 | 360 | |
361 | - return tap($column, function ($value) { |
|
361 | + return tap($column, function($value) { |
|
362 | 362 | $this->columns->push($value); |
363 | 363 | }); |
364 | 364 | } |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | $column = new Column($column, $label); |
423 | 423 | $column->setGrid($this); |
424 | 424 | |
425 | - return tap($column, function ($value) { |
|
425 | + return tap($column, function($value) { |
|
426 | 426 | $this->columns->prepend($value); |
427 | 427 | }); |
428 | 428 | } |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | |
589 | 589 | $data = $collection->toArray(); |
590 | 590 | |
591 | - $this->columns->map(function (Column $column) use (&$data) { |
|
591 | + $this->columns->map(function(Column $column) use (&$data) { |
|
592 | 592 | $data = $column->fill($data); |
593 | 593 | |
594 | 594 | $this->columnNames[] = $column->getName(); |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | */ |
609 | 609 | protected function buildRows(array $data) |
610 | 610 | { |
611 | - $this->rows = collect($data)->map(function ($model, $number) { |
|
611 | + $this->rows = collect($data)->map(function($model, $number) { |
|
612 | 612 | return new Row($number, $model, $this->keyName); |
613 | 613 | }); |
614 | 614 |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | namespace Encore\Admin\Grid\Actions; |
4 | 4 | |
5 | -use Encore\Admin\Actions\Response; |
|
6 | -use Encore\Admin\Actions\RowAction; |
|
5 | +use Encore\Admin\Actions\Response; |
|
6 | +use Encore\Admin\Actions\RowAction; |
|
7 | 7 | use Illuminate\Database\Eloquent\Model; |
8 | 8 | |
9 | 9 | class Delete extends RowAction |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | /** |
356 | 356 | * Get name of this column. |
357 | 357 | * |
358 | - * @return mixed |
|
358 | + * @return string |
|
359 | 359 | */ |
360 | 360 | public function getName() |
361 | 361 | { |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | /** |
394 | 394 | * Get label of the column. |
395 | 395 | * |
396 | - * @return mixed |
|
396 | + * @return string |
|
397 | 397 | */ |
398 | 398 | public function getLabel() |
399 | 399 | { |
@@ -2,15 +2,15 @@ |
||
2 | 2 | |
3 | 3 | namespace Encore\Admin\Grid; |
4 | 4 | |
5 | -use Carbon\Carbon; |
|
6 | -use Closure; |
|
7 | -use Encore\Admin\Actions\RowAction; |
|
8 | -use Encore\Admin\Grid; |
|
9 | -use Encore\Admin\Grid\Displayers\AbstractDisplayer; |
|
10 | -use Illuminate\Contracts\Support\Arrayable; |
|
11 | -use Illuminate\Database\Eloquent\Model as BaseModel; |
|
12 | -use Illuminate\Support\Arr; |
|
13 | -use Illuminate\Support\Collection; |
|
5 | +use Carbon\Carbon; |
|
6 | +use Closure; |
|
7 | +use Encore\Admin\Actions\RowAction; |
|
8 | +use Encore\Admin\Grid; |
|
9 | +use Encore\Admin\Grid\Displayers\AbstractDisplayer; |
|
10 | +use Illuminate\Contracts\Support\Arrayable; |
|
11 | +use Illuminate\Database\Eloquent\Model as BaseModel; |
|
12 | +use Illuminate\Support\Arr; |
|
13 | +use Illuminate\Support\Collection; |
|
14 | 14 | use Illuminate\Support\Str; |
15 | 15 | |
16 | 16 | /** |
@@ -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); |
@@ -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(); |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | */ |
636 | 636 | public function filesize() |
637 | 637 | { |
638 | - return $this->display(function ($value) { |
|
638 | + return $this->display(function($value) { |
|
639 | 639 | return file_size($value); |
640 | 640 | }); |
641 | 641 | } |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | */ |
650 | 650 | public function gravatar($size = 30) |
651 | 651 | { |
652 | - return $this->display(function ($value) use ($size) { |
|
652 | + return $this->display(function($value) use ($size) { |
|
653 | 653 | $src = sprintf( |
654 | 654 | 'https://www.gravatar.com/avatar/%s?s=%d', |
655 | 655 | md5(strtolower($value)), |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | */ |
671 | 671 | public function loading($values = [], $others = []) |
672 | 672 | { |
673 | - return $this->display(function ($value) use ($values, $others) { |
|
673 | + return $this->display(function($value) use ($values, $others) { |
|
674 | 674 | $values = (array) $values; |
675 | 675 | |
676 | 676 | if (in_array($value, $values)) { |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | */ |
692 | 692 | public function icon(array $setting, $default = '') |
693 | 693 | { |
694 | - return $this->display(function ($value) use ($setting, $default) { |
|
694 | + return $this->display(function($value) use ($setting, $default) { |
|
695 | 695 | $fa = ''; |
696 | 696 | |
697 | 697 | if (isset($setting[$value])) { |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | Carbon::setLocale($locale); |
718 | 718 | } |
719 | 719 | |
720 | - return $this->display(function ($value) { |
|
720 | + return $this->display(function($value) { |
|
721 | 721 | return Carbon::parse($value)->diffForHumans(); |
722 | 722 | }); |
723 | 723 | } |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | */ |
732 | 732 | public function date($format) |
733 | 733 | { |
734 | - return $this->display(function ($value) use ($format) { |
|
734 | + return $this->display(function($value) use ($format) { |
|
735 | 735 | return date($format, strtotime($value)); |
736 | 736 | }); |
737 | 737 | } |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | */ |
747 | 747 | public function bool(array $map = [], $default = false) |
748 | 748 | { |
749 | - return $this->display(function ($value) use ($map, $default) { |
|
749 | + return $this->display(function($value) use ($map, $default) { |
|
750 | 750 | $bool = empty($map) ? boolval($value) : Arr::get($map, $value, $default); |
751 | 751 | |
752 | 752 | return $bool ? '<i class="fa fa-check text-green"></i>' : '<i class="fa fa-close text-red"></i>'; |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | |
769 | 769 | $grid = $this->grid; |
770 | 770 | |
771 | - return $this->display(function ($_, $column) use ($action, $grid) { |
|
771 | + return $this->display(function($_, $column) use ($action, $grid) { |
|
772 | 772 | /** @var RowAction $action */ |
773 | 773 | $action = new $action(); |
774 | 774 | |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | */ |
791 | 791 | public function dot($options = [], $default = '') |
792 | 792 | { |
793 | - return $this->prefix(function ($_, $original) use ($options, $default) { |
|
793 | + return $this->prefix(function($_, $original) use ($options, $default) { |
|
794 | 794 | if (is_null($original)) { |
795 | 795 | $style = $default; |
796 | 796 | } else { |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | $grid = $this->grid; |
918 | 918 | $column = $this; |
919 | 919 | |
920 | - $this->display(function ($value) use ($grid, $column, $class) { |
|
920 | + $this->display(function($value) use ($grid, $column, $class) { |
|
921 | 921 | /** @var AbstractDisplayer $definition */ |
922 | 922 | $definition = new $class($value, $grid, $column, $this); |
923 | 923 | |
@@ -935,7 +935,7 @@ discard block |
||
935 | 935 | protected function htmlEntityEncode($item) |
936 | 936 | { |
937 | 937 | if (is_array($item)) { |
938 | - array_walk_recursive($item, function (&$value) { |
|
938 | + array_walk_recursive($item, function(&$value) { |
|
939 | 939 | $value = htmlentities($value); |
940 | 940 | }); |
941 | 941 | } else { |
@@ -972,7 +972,7 @@ discard block |
||
972 | 972 | */ |
973 | 973 | protected function callSupportDisplayer($abstract, $arguments) |
974 | 974 | { |
975 | - return $this->display(function ($value) use ($abstract, $arguments) { |
|
975 | + return $this->display(function($value) use ($abstract, $arguments) { |
|
976 | 976 | if (is_array($value) || $value instanceof Arrayable) { |
977 | 977 | return call_user_func_array([collect($value), $abstract], $arguments); |
978 | 978 | } |
@@ -996,7 +996,7 @@ discard block |
||
996 | 996 | protected function callBuiltinDisplayer($abstract, $arguments) |
997 | 997 | { |
998 | 998 | if ($abstract instanceof Closure) { |
999 | - return $this->display(function ($value) use ($abstract, $arguments) { |
|
999 | + return $this->display(function($value) use ($abstract, $arguments) { |
|
1000 | 1000 | return $abstract->call($this, ...array_merge([$value], $arguments)); |
1001 | 1001 | }); |
1002 | 1002 | } |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | $grid = $this->grid; |
1006 | 1006 | $column = $this; |
1007 | 1007 | |
1008 | - return $this->display(function ($value) use ($abstract, $grid, $column, $arguments) { |
|
1008 | + return $this->display(function($value) use ($abstract, $grid, $column, $arguments) { |
|
1009 | 1009 | /** @var AbstractDisplayer $displayer */ |
1010 | 1010 | $displayer = new $abstract($value, $grid, $column, $this); |
1011 | 1011 |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace Encore\Admin\Grid\Column; |
4 | 4 | |
5 | -use Encore\Admin\Admin; |
|
5 | +use Encore\Admin\Admin; |
|
6 | 6 | use Encore\Admin\Grid\Model; |
7 | 7 | |
8 | 8 | class CheckFilter extends Filter |
@@ -76,7 +76,7 @@ |
||
76 | 76 | { |
77 | 77 | $value = $this->getFilterValue([]); |
78 | 78 | |
79 | - $lists = collect($this->options)->map(function ($label, $key) use ($value) { |
|
79 | + $lists = collect($this->options)->map(function($label, $key) use ($value) { |
|
80 | 80 | $checked = in_array($key, $value) ? 'checked' : ''; |
81 | 81 | |
82 | 82 | return <<<HTML |
@@ -43,7 +43,7 @@ |
||
43 | 43 | * |
44 | 44 | * @param string $cast |
45 | 45 | * |
46 | - * @return Column|string |
|
46 | + * @return HasHeader |
|
47 | 47 | */ |
48 | 48 | protected function addSorter($cast = null) |
49 | 49 | { |
@@ -2,9 +2,9 @@ |
||
2 | 2 | |
3 | 3 | namespace Encore\Admin\Grid\Column; |
4 | 4 | |
5 | -use Encore\Admin\Grid\Column; |
|
6 | -use Encore\Admin\Grid\Model; |
|
7 | -use Illuminate\Contracts\Support\Htmlable; |
|
5 | +use Encore\Admin\Grid\Column; |
|
6 | +use Encore\Admin\Grid\Model; |
|
7 | +use Illuminate\Contracts\Support\Htmlable; |
|
8 | 8 | use Illuminate\Contracts\Support\Renderable; |
9 | 9 | |
10 | 10 | trait HasHeader |
@@ -115,7 +115,7 @@ |
||
115 | 115 | */ |
116 | 116 | public function renderHeader() |
117 | 117 | { |
118 | - return collect($this->headers)->map(function ($item) { |
|
118 | + return collect($this->headers)->map(function($item) { |
|
119 | 119 | if ($item instanceof Renderable) { |
120 | 120 | return $item->render(); |
121 | 121 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | * Add a binding to the query. |
28 | 28 | * |
29 | 29 | * @param string $value |
30 | - * @param Model|null $model |
|
30 | + * @param Model $model |
|
31 | 31 | */ |
32 | 32 | public function addBinding($value, Model $model) |
33 | 33 | { |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace Encore\Admin\Grid\Column; |
4 | 4 | |
5 | -use Encore\Admin\Admin; |
|
5 | +use Encore\Admin\Admin; |
|
6 | 6 | use Encore\Admin\Grid\Model; |
7 | 7 | |
8 | 8 | class InputFilter extends Filter |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace Encore\Admin\Grid\Column; |
4 | 4 | |
5 | -use Encore\Admin\Admin; |
|
5 | +use Encore\Admin\Admin; |
|
6 | 6 | use Encore\Admin\Grid\Model; |
7 | 7 | |
8 | 8 | class RangeFilter extends Filter |
@@ -2,7 +2,7 @@ |
||
2 | 2 | |
3 | 3 | namespace Encore\Admin\Grid\Concerns; |
4 | 4 | |
5 | -use Encore\Admin\Grid\Tools\FixColumns; |
|
5 | +use Encore\Admin\Grid\Tools\FixColumns; |
|
6 | 6 | use Illuminate\Support\Collection; |
7 | 7 | |
8 | 8 | trait CanFixColumns |