@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | */ |
286 | 286 | public function removeFilterByID($id) |
287 | 287 | { |
288 | - $this->filters = array_filter($this->filters, function (AbstractFilter $filter) use ($id) { |
|
288 | + $this->filters = array_filter($this->filters, function(AbstractFilter $filter) use ($id) { |
|
289 | 289 | return $filter->getId() != $id; |
290 | 290 | }); |
291 | 291 | } |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | { |
300 | 300 | $inputs = Arr::dot(request()->all()); |
301 | 301 | |
302 | - $inputs = array_filter($inputs, function ($input) { |
|
302 | + $inputs = array_filter($inputs, function($input) { |
|
303 | 303 | return $input !== '' && !is_null($input); |
304 | 304 | }); |
305 | 305 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | } |
328 | 328 | } |
329 | 329 | |
330 | - return tap(array_filter($conditions), function ($conditions) { |
|
330 | + return tap(array_filter($conditions), function($conditions) { |
|
331 | 331 | if (!empty($conditions)) { |
332 | 332 | $this->expand(); |
333 | 333 | } |
@@ -345,9 +345,9 @@ discard block |
||
345 | 345 | return $inputs; |
346 | 346 | } |
347 | 347 | |
348 | - $inputs = collect($inputs)->filter(function ($input, $key) { |
|
348 | + $inputs = collect($inputs)->filter(function($input, $key) { |
|
349 | 349 | return Str::startsWith($key, "{$this->name}_"); |
350 | - })->mapWithKeys(function ($val, $key) { |
|
350 | + })->mapWithKeys(function($val, $key) { |
|
351 | 351 | $key = str_replace("{$this->name}_", '', $key); |
352 | 352 | |
353 | 353 | return [$key => $val]; |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | */ |
418 | 418 | public function scope($key, $label = '') |
419 | 419 | { |
420 | - return tap(new Scope($key, $label), function (Scope $scope) { |
|
420 | + return tap(new Scope($key, $label), function(Scope $scope) { |
|
421 | 421 | return $this->scopes->push($scope); |
422 | 422 | }); |
423 | 423 | } |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | { |
442 | 442 | $key = request(Scope::QUERY_NAME); |
443 | 443 | |
444 | - return $this->scopes->first(function ($scope) use ($key) { |
|
444 | + return $this->scopes->first(function($scope) use ($key) { |
|
445 | 445 | return $scope->key == $key; |
446 | 446 | }); |
447 | 447 | } |
@@ -566,9 +566,9 @@ discard block |
||
566 | 566 | |
567 | 567 | $columns->push($pageKey); |
568 | 568 | |
569 | - $groupNames = collect($this->filters)->filter(function ($filter) { |
|
569 | + $groupNames = collect($this->filters)->filter(function($filter) { |
|
570 | 570 | return $filter instanceof Filter\Group; |
571 | - })->map(function (AbstractFilter $filter) { |
|
571 | + })->map(function(AbstractFilter $filter) { |
|
572 | 572 | return "{$filter->getId()}_group"; |
573 | 573 | }); |
574 | 574 |
@@ -390,7 +390,7 @@ |
||
390 | 390 | * |
391 | 391 | * @param $name |
392 | 392 | * @param $slug |
393 | - * @param $path |
|
393 | + * @param string $path |
|
394 | 394 | * @param array $methods |
395 | 395 | */ |
396 | 396 | protected static function createPermission($name, $slug, $path, $methods = []) |
@@ -236,7 +236,7 @@ |
||
236 | 236 | public static function import() |
237 | 237 | { |
238 | 238 | $extension = static::getInstance(); |
239 | - DB::transaction(function () use ($extension) { |
|
239 | + DB::transaction(function() use ($extension) { |
|
240 | 240 | if ($menu = $extension->menu()) { |
241 | 241 | if ($extension->validateMenu($menu)) { |
242 | 242 | extract($menu); |
@@ -89,7 +89,7 @@ |
||
89 | 89 | /** |
90 | 90 | * Remove reserved fields from form layout. |
91 | 91 | * |
92 | - * @param array $fields |
|
92 | + * @param string[] $fields |
|
93 | 93 | */ |
94 | 94 | public function removeReservedFields(array $fields) |
95 | 95 | { |
@@ -48,7 +48,7 @@ |
||
48 | 48 | */ |
49 | 49 | public function removeFields($fields) |
50 | 50 | { |
51 | - $this->fields = $this->fields->reject(function (Field $field) use ($fields) { |
|
51 | + $this->fields = $this->fields->reject(function(Field $field) use ($fields) { |
|
52 | 52 | return in_array($field->column(), $fields); |
53 | 53 | }); |
54 | 54 | } |
@@ -42,7 +42,7 @@ |
||
42 | 42 | if (empty($selectedOption)) { |
43 | 43 | $selected = $this->choice('Please choose a role for the user', $selectedOption, null, null, true); |
44 | 44 | |
45 | - $roles = $roles->filter(function ($role) use ($selected) { |
|
45 | + $roles = $roles->filter(function($role) use ($selected) { |
|
46 | 46 | return in_array($role->name, $selected); |
47 | 47 | }); |
48 | 48 | } |
@@ -45,7 +45,7 @@ |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
48 | - * @return mixed |
|
48 | + * @return string |
|
49 | 49 | */ |
50 | 50 | protected function getModelClass() |
51 | 51 | { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | /** |
89 | 89 | * Get name of this column. |
90 | 90 | * |
91 | - * @return mixed |
|
91 | + * @return string |
|
92 | 92 | */ |
93 | 93 | public function getName() |
94 | 94 | { |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | /** |
113 | 113 | * Get label of the column. |
114 | 114 | * |
115 | - * @return mixed |
|
115 | + * @return string |
|
116 | 116 | */ |
117 | 117 | public function getLabel() |
118 | 118 | { |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | $name = $this->getName(); |
491 | 491 | $query = request()->query(); |
492 | 492 | |
493 | - $this->prefix(function ($_, $original) use ($name, $query) { |
|
493 | + $this->prefix(function($_, $original) use ($name, $query) { |
|
494 | 494 | Arr::set($query, $name, $original); |
495 | 495 | |
496 | 496 | $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,13 +595,13 @@ discard block |
||
595 | 595 | public function repeat($input, $seperator = '') |
596 | 596 | { |
597 | 597 | if (is_string($input)) { |
598 | - $input = function () use ($input) { |
|
598 | + $input = function() use ($input) { |
|
599 | 599 | return $input; |
600 | 600 | }; |
601 | 601 | } |
602 | 602 | |
603 | 603 | if ($input instanceof Closure) { |
604 | - return $this->display(function ($value) use ($input, $seperator) { |
|
604 | + return $this->display(function($value) use ($input, $seperator) { |
|
605 | 605 | return join($seperator, array_fill(0, (int) $value, $input->call($this, [$value]))); |
606 | 606 | }); |
607 | 607 | } |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | */ |
619 | 619 | public function view($view) |
620 | 620 | { |
621 | - return $this->display(function ($value) use ($view) { |
|
621 | + return $this->display(function($value) use ($view) { |
|
622 | 622 | $model = $this; |
623 | 623 | |
624 | 624 | return view($view, compact('model', 'value'))->render(); |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | */ |
659 | 659 | public function filesize() |
660 | 660 | { |
661 | - return $this->display(function ($value) { |
|
661 | + return $this->display(function($value) { |
|
662 | 662 | return file_size($value); |
663 | 663 | }); |
664 | 664 | } |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | */ |
673 | 673 | public function gravatar($size = 30) |
674 | 674 | { |
675 | - return $this->display(function ($value) use ($size) { |
|
675 | + return $this->display(function($value) use ($size) { |
|
676 | 676 | $src = sprintf( |
677 | 677 | 'https://www.gravatar.com/avatar/%s?s=%d', |
678 | 678 | md5(strtolower($value)), |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | */ |
694 | 694 | public function loading($values = [], $others = []) |
695 | 695 | { |
696 | - return $this->display(function ($value) use ($values, $others) { |
|
696 | + return $this->display(function($value) use ($values, $others) { |
|
697 | 697 | $values = (array) $values; |
698 | 698 | |
699 | 699 | if (in_array($value, $values)) { |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | */ |
715 | 715 | public function icon(array $setting, $default = '') |
716 | 716 | { |
717 | - return $this->display(function ($value) use ($setting, $default) { |
|
717 | + return $this->display(function($value) use ($setting, $default) { |
|
718 | 718 | $fa = ''; |
719 | 719 | |
720 | 720 | if (isset($setting[$value])) { |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | Carbon::setLocale($locale); |
741 | 741 | } |
742 | 742 | |
743 | - return $this->display(function ($value) { |
|
743 | + return $this->display(function($value) { |
|
744 | 744 | return Carbon::parse($value)->diffForHumans(); |
745 | 745 | }); |
746 | 746 | } |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | */ |
770 | 770 | public function bool(array $map = [], $default = false) |
771 | 771 | { |
772 | - return $this->display(function ($value) use ($map, $default) { |
|
772 | + return $this->display(function($value) use ($map, $default) { |
|
773 | 773 | $bool = empty($map) ? boolval($value) : Arr::get($map, $value, $default); |
774 | 774 | |
775 | 775 | return $bool ? '<i class="fa fa-check text-green"></i>' : '<i class="fa fa-close text-red"></i>'; |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | */ |
785 | 785 | public function default($default = '-') |
786 | 786 | { |
787 | - return $this->display(function ($value) use ($default) { |
|
787 | + return $this->display(function($value) use ($default) { |
|
788 | 788 | return $value ?: $default; |
789 | 789 | }); |
790 | 790 | } |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | |
805 | 805 | $grid = $this->grid; |
806 | 806 | |
807 | - return $this->display(function ($_, $column) use ($action, $grid) { |
|
807 | + return $this->display(function($_, $column) use ($action, $grid) { |
|
808 | 808 | /** @var RowAction $action */ |
809 | 809 | $action = new $action(); |
810 | 810 | |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | */ |
827 | 827 | public function dot($options = [], $default = '') |
828 | 828 | { |
829 | - return $this->prefix(function ($_, $original) use ($options, $default) { |
|
829 | + return $this->prefix(function($_, $original) use ($options, $default) { |
|
830 | 830 | if (is_null($original)) { |
831 | 831 | $style = $default; |
832 | 832 | } else { |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | $grid = $this->grid; |
1038 | 1038 | $column = $this; |
1039 | 1039 | |
1040 | - $this->display(function ($value) use ($grid, $column, $class) { |
|
1040 | + $this->display(function($value) use ($grid, $column, $class) { |
|
1041 | 1041 | /** @var AbstractDisplayer $definition */ |
1042 | 1042 | $definition = new $class($value, $grid, $column, $this); |
1043 | 1043 | |
@@ -1055,7 +1055,7 @@ discard block |
||
1055 | 1055 | protected function htmlEntityEncode($item) |
1056 | 1056 | { |
1057 | 1057 | if (is_array($item)) { |
1058 | - array_walk_recursive($item, function (&$value) { |
|
1058 | + array_walk_recursive($item, function(&$value) { |
|
1059 | 1059 | $value = htmlentities($value); |
1060 | 1060 | }); |
1061 | 1061 | } else { |
@@ -1092,7 +1092,7 @@ discard block |
||
1092 | 1092 | */ |
1093 | 1093 | protected function callSupportDisplayer($abstract, $arguments) |
1094 | 1094 | { |
1095 | - return $this->display(function ($value) use ($abstract, $arguments) { |
|
1095 | + return $this->display(function($value) use ($abstract, $arguments) { |
|
1096 | 1096 | if (is_array($value) || $value instanceof Arrayable) { |
1097 | 1097 | return call_user_func_array([collect($value), $abstract], $arguments); |
1098 | 1098 | } |
@@ -1116,7 +1116,7 @@ discard block |
||
1116 | 1116 | protected function callBuiltinDisplayer($abstract, $arguments) |
1117 | 1117 | { |
1118 | 1118 | if ($abstract instanceof Closure) { |
1119 | - return $this->display(function ($value) use ($abstract, $arguments) { |
|
1119 | + return $this->display(function($value) use ($abstract, $arguments) { |
|
1120 | 1120 | return $abstract->call($this, ...array_merge([$value], $arguments)); |
1121 | 1121 | }); |
1122 | 1122 | } |
@@ -1125,7 +1125,7 @@ discard block |
||
1125 | 1125 | $grid = $this->grid; |
1126 | 1126 | $column = $this; |
1127 | 1127 | |
1128 | - return $this->display(function ($value) use ($abstract, $grid, $column, $arguments) { |
|
1128 | + return $this->display(function($value) use ($abstract, $grid, $column, $arguments) { |
|
1129 | 1129 | /** @var AbstractDisplayer $displayer */ |
1130 | 1130 | $displayer = new $abstract($value, $grid, $column, $this); |
1131 | 1131 |
@@ -112,7 +112,7 @@ |
||
112 | 112 | */ |
113 | 113 | protected static function bootHasPermissions() |
114 | 114 | { |
115 | - static::deleting(function ($model) { |
|
115 | + static::deleting(function($model) { |
|
116 | 116 | $model->roles()->detach(); |
117 | 117 | |
118 | 118 | $model->permissions()->detach(); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | /** |
10 | 10 | * Get all permissions of user. |
11 | 11 | * |
12 | - * @return mixed |
|
12 | + * @return Collection |
|
13 | 13 | */ |
14 | 14 | public function allPermissions(): Collection |
15 | 15 | { |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | /** |
20 | 20 | * Check if user has permission. |
21 | 21 | * |
22 | - * @param $ability |
|
22 | + * @param string $ability |
|
23 | 23 | * @param array $arguments |
24 | 24 | * |
25 | 25 | * @return bool |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | /** |
57 | 57 | * Check if user is administrator. |
58 | 58 | * |
59 | - * @return mixed |
|
59 | + * @return boolean |
|
60 | 60 | */ |
61 | 61 | public function isAdministrator(): bool |
62 | 62 | { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @param string $role |
70 | 70 | * |
71 | - * @return mixed |
|
71 | + * @return boolean |
|
72 | 72 | */ |
73 | 73 | public function isRole(string $role): bool |
74 | 74 | { |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * |
81 | 81 | * @param array $roles |
82 | 82 | * |
83 | - * @return mixed |
|
83 | + * @return boolean |
|
84 | 84 | */ |
85 | 85 | public function inRoles(array $roles = []): bool |
86 | 86 | { |
@@ -347,9 +347,9 @@ discard block |
||
347 | 347 | |
348 | 348 | $this->setSort(); |
349 | 349 | |
350 | - $this->queries->reject(function ($query) { |
|
350 | + $this->queries->reject(function($query) { |
|
351 | 351 | return $query['method'] == 'paginate'; |
352 | - })->each(function ($query) { |
|
352 | + })->each(function($query) { |
|
353 | 353 | $this->model = $this->model->{$query['method']}(...$query['arguments']); |
354 | 354 | }); |
355 | 355 | |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | $this->setSort(); |
401 | 401 | $this->setPaginate(); |
402 | 402 | |
403 | - $this->queries->unique()->each(function ($query) { |
|
403 | + $this->queries->unique()->each(function($query) { |
|
404 | 404 | $this->model = call_user_func_array([$this->model, $query['method']], $query['arguments']); |
405 | 405 | }); |
406 | 406 | |
@@ -430,9 +430,9 @@ discard block |
||
430 | 430 | |
431 | 431 | $queryBuilder = $this->originalModel; |
432 | 432 | |
433 | - $this->queries->reject(function ($query) { |
|
433 | + $this->queries->reject(function($query) { |
|
434 | 434 | return in_array($query['method'], ['get', 'paginate']); |
435 | - })->each(function ($query) use (&$queryBuilder) { |
|
435 | + })->each(function($query) use (&$queryBuilder) { |
|
436 | 436 | $queryBuilder = $queryBuilder->{$query['method']}(...$query['arguments']); |
437 | 437 | }); |
438 | 438 | |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | { |
467 | 467 | $paginate = $this->findQueryByMethod('paginate'); |
468 | 468 | |
469 | - $this->queries = $this->queries->reject(function ($query) { |
|
469 | + $this->queries = $this->queries->reject(function($query) { |
|
470 | 470 | return $query['method'] == 'paginate'; |
471 | 471 | }); |
472 | 472 | |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | */ |
525 | 525 | protected function findQueryByMethod($method) |
526 | 526 | { |
527 | - return $this->queries->first(function ($query) use ($method) { |
|
527 | + return $this->queries->first(function($query) use ($method) { |
|
528 | 528 | return $query['method'] == $method; |
529 | 529 | }); |
530 | 530 | } |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | } |
548 | 548 | |
549 | 549 | $columnNameContainsDots = Str::contains($columnName, '.'); |
550 | - $isRelation = $this->queries->contains(function ($query) use ($columnName) { |
|
550 | + $isRelation = $this->queries->contains(function($query) use ($columnName) { |
|
551 | 551 | return $query['method'] === 'with' && in_array($columnName, $query['arguments'], true); |
552 | 552 | }); |
553 | 553 | if ($columnNameContainsDots === true && $isRelation) { |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | { |
594 | 594 | list($relationName, $relationColumn) = explode('.', $column); |
595 | 595 | |
596 | - if ($this->queries->contains(function ($query) use ($relationName) { |
|
596 | + if ($this->queries->contains(function($query) use ($relationName) { |
|
597 | 597 | return $query['method'] == 'with' && in_array($relationName, $query['arguments']); |
598 | 598 | })) { |
599 | 599 | $relation = $this->model->$relationName(); |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | */ |
628 | 628 | public function resetOrderBy() |
629 | 629 | { |
630 | - $this->queries = $this->queries->reject(function ($query) { |
|
630 | + $this->queries = $this->queries->reject(function($query) { |
|
631 | 631 | return $query['method'] == 'orderBy' || $query['method'] == 'orderByDesc'; |
632 | 632 | }); |
633 | 633 | } |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | /** |
468 | 468 | * Resolve perPage for pagination. |
469 | 469 | * |
470 | - * @param array|null $paginate |
|
470 | + * @param Model $paginate |
|
471 | 471 | * |
472 | 472 | * @return array |
473 | 473 | */ |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | /** |
498 | 498 | * Find query by method name. |
499 | 499 | * |
500 | - * @param $method |
|
500 | + * @param string $method |
|
501 | 501 | * |
502 | 502 | * @return static |
503 | 503 | */ |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | |
652 | 652 | /** |
653 | 653 | * @param string $method |
654 | - * @param array $arguments |
|
654 | + * @param integer[] $arguments |
|
655 | 655 | * |
656 | 656 | * @return $this |
657 | 657 | */ |