@@ -120,7 +120,7 @@ |
||
120 | 120 | public function style($style) |
121 | 121 | { |
122 | 122 | if (is_array($style)) { |
123 | - $style = implode(';', array_map(function ($key, $val) { |
|
123 | + $style = implode(';', array_map(function($key, $val) { |
|
124 | 124 | return "$key:$val"; |
125 | 125 | }, array_keys($style), array_values($style))); |
126 | 126 | } |
@@ -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 | { |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | $name = $this->getName(); |
493 | 493 | $query = request()->query(); |
494 | 494 | |
495 | - $this->prefix(function ($_, $original) use ($name, $query) { |
|
495 | + $this->prefix(function($_, $original) use ($name, $query) { |
|
496 | 496 | Arr::set($query, $name, $original); |
497 | 497 | |
498 | 498 | $url = request()->fullUrlWithQuery($query); |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | |
544 | 544 | $column = $this; |
545 | 545 | |
546 | - return $this->display(function ($value) use ($grid, $column, $abstract, $arguments) { |
|
546 | + return $this->display(function($value) use ($grid, $column, $abstract, $arguments) { |
|
547 | 547 | /** @var AbstractDisplayer $displayer */ |
548 | 548 | $displayer = new $abstract($value, $grid, $column, $this); |
549 | 549 | |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | */ |
562 | 562 | public function using(array $values, $default = null) |
563 | 563 | { |
564 | - return $this->display(function ($value) use ($values, $default) { |
|
564 | + return $this->display(function($value) use ($values, $default) { |
|
565 | 565 | if (is_null($value)) { |
566 | 566 | return $default; |
567 | 567 | } |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | */ |
580 | 580 | public function replace(array $replacements) |
581 | 581 | { |
582 | - return $this->display(function ($value) use ($replacements) { |
|
582 | + return $this->display(function($value) use ($replacements) { |
|
583 | 583 | if (isset($replacements[$value])) { |
584 | 584 | return $replacements[$value]; |
585 | 585 | } |
@@ -597,13 +597,13 @@ discard block |
||
597 | 597 | public function repeat($input, $seperator = '') |
598 | 598 | { |
599 | 599 | if (is_string($input)) { |
600 | - $input = function () use ($input) { |
|
600 | + $input = function() use ($input) { |
|
601 | 601 | return $input; |
602 | 602 | }; |
603 | 603 | } |
604 | 604 | |
605 | 605 | if ($input instanceof Closure) { |
606 | - return $this->display(function ($value) use ($input, $seperator) { |
|
606 | + return $this->display(function($value) use ($input, $seperator) { |
|
607 | 607 | return join($seperator, array_fill(0, (int) $value, $input->call($this, [$value]))); |
608 | 608 | }); |
609 | 609 | } |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | */ |
621 | 621 | public function view($view) |
622 | 622 | { |
623 | - return $this->display(function ($value) use ($view) { |
|
623 | + return $this->display(function($value) use ($view) { |
|
624 | 624 | $model = $this; |
625 | 625 | |
626 | 626 | return view($view, compact('model', 'value'))->render(); |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | */ |
661 | 661 | public function filesize() |
662 | 662 | { |
663 | - return $this->display(function ($value) { |
|
663 | + return $this->display(function($value) { |
|
664 | 664 | return file_size($value); |
665 | 665 | }); |
666 | 666 | } |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | */ |
675 | 675 | public function gravatar($size = 30) |
676 | 676 | { |
677 | - return $this->display(function ($value) use ($size) { |
|
677 | + return $this->display(function($value) use ($size) { |
|
678 | 678 | $src = sprintf( |
679 | 679 | 'https://www.gravatar.com/avatar/%s?s=%d', |
680 | 680 | md5(strtolower($value)), |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | */ |
696 | 696 | public function loading($values = [], $others = []) |
697 | 697 | { |
698 | - return $this->display(function ($value) use ($values, $others) { |
|
698 | + return $this->display(function($value) use ($values, $others) { |
|
699 | 699 | $values = (array) $values; |
700 | 700 | |
701 | 701 | if (in_array($value, $values)) { |
@@ -716,7 +716,7 @@ discard block |
||
716 | 716 | */ |
717 | 717 | public function icon(array $setting, $default = '') |
718 | 718 | { |
719 | - return $this->display(function ($value) use ($setting, $default) { |
|
719 | + return $this->display(function($value) use ($setting, $default) { |
|
720 | 720 | $fa = ''; |
721 | 721 | |
722 | 722 | if (isset($setting[$value])) { |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | Carbon::setLocale($locale); |
743 | 743 | } |
744 | 744 | |
745 | - return $this->display(function ($value) { |
|
745 | + return $this->display(function($value) { |
|
746 | 746 | return Carbon::parse($value)->diffForHumans(); |
747 | 747 | }); |
748 | 748 | } |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | */ |
757 | 757 | public function date($format) |
758 | 758 | { |
759 | - return $this->display(function ($value) use ($format) { |
|
759 | + return $this->display(function($value) use ($format) { |
|
760 | 760 | return date($format, strtotime($value)); |
761 | 761 | }); |
762 | 762 | } |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | */ |
772 | 772 | public function bool(array $map = [], $default = false) |
773 | 773 | { |
774 | - return $this->display(function ($value) use ($map, $default) { |
|
774 | + return $this->display(function($value) use ($map, $default) { |
|
775 | 775 | $bool = empty($map) ? boolval($value) : Arr::get($map, $value, $default); |
776 | 776 | |
777 | 777 | return $bool ? '<i class="fa fa-check text-green"></i>' : '<i class="fa fa-close text-red"></i>'; |
@@ -786,7 +786,7 @@ discard block |
||
786 | 786 | */ |
787 | 787 | public function default($default = '-') |
788 | 788 | { |
789 | - return $this->display(function ($value) use ($default) { |
|
789 | + return $this->display(function($value) use ($default) { |
|
790 | 790 | return $value ?: $default; |
791 | 791 | }); |
792 | 792 | } |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | |
807 | 807 | $grid = $this->grid; |
808 | 808 | |
809 | - return $this->display(function ($_, $column) use ($action, $grid) { |
|
809 | + return $this->display(function($_, $column) use ($action, $grid) { |
|
810 | 810 | /** @var RowAction $action */ |
811 | 811 | $action = new $action(); |
812 | 812 | |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | */ |
829 | 829 | public function dot($options = [], $default = '') |
830 | 830 | { |
831 | - return $this->prefix(function ($_, $original) use ($options, $default) { |
|
831 | + return $this->prefix(function($_, $original) use ($options, $default) { |
|
832 | 832 | if (is_null($original)) { |
833 | 833 | $style = $default; |
834 | 834 | } else { |
@@ -983,7 +983,7 @@ discard block |
||
983 | 983 | $grid = $this->grid; |
984 | 984 | $column = $this; |
985 | 985 | |
986 | - $this->display(function ($value) use ($grid, $column, $class) { |
|
986 | + $this->display(function($value) use ($grid, $column, $class) { |
|
987 | 987 | /** @var AbstractDisplayer $definition */ |
988 | 988 | $definition = new $class($value, $grid, $column, $this); |
989 | 989 | |
@@ -1001,7 +1001,7 @@ discard block |
||
1001 | 1001 | protected function htmlEntityEncode($item) |
1002 | 1002 | { |
1003 | 1003 | if (is_array($item)) { |
1004 | - array_walk_recursive($item, function (&$value) { |
|
1004 | + array_walk_recursive($item, function(&$value) { |
|
1005 | 1005 | $value = htmlentities($value); |
1006 | 1006 | }); |
1007 | 1007 | } else { |
@@ -1038,7 +1038,7 @@ discard block |
||
1038 | 1038 | */ |
1039 | 1039 | protected function callSupportDisplayer($abstract, $arguments) |
1040 | 1040 | { |
1041 | - return $this->display(function ($value) use ($abstract, $arguments) { |
|
1041 | + return $this->display(function($value) use ($abstract, $arguments) { |
|
1042 | 1042 | if (is_array($value) || $value instanceof Arrayable) { |
1043 | 1043 | return call_user_func_array([collect($value), $abstract], $arguments); |
1044 | 1044 | } |
@@ -1062,7 +1062,7 @@ discard block |
||
1062 | 1062 | protected function callBuiltinDisplayer($abstract, $arguments) |
1063 | 1063 | { |
1064 | 1064 | if ($abstract instanceof Closure) { |
1065 | - return $this->display(function ($value) use ($abstract, $arguments) { |
|
1065 | + return $this->display(function($value) use ($abstract, $arguments) { |
|
1066 | 1066 | return $abstract->call($this, ...array_merge([$value], $arguments)); |
1067 | 1067 | }); |
1068 | 1068 | } |
@@ -1071,7 +1071,7 @@ discard block |
||
1071 | 1071 | $grid = $this->grid; |
1072 | 1072 | $column = $this; |
1073 | 1073 | |
1074 | - return $this->display(function ($value) use ($abstract, $grid, $column, $arguments) { |
|
1074 | + return $this->display(function($value) use ($abstract, $grid, $column, $arguments) { |
|
1075 | 1075 | /** @var AbstractDisplayer $displayer */ |
1076 | 1076 | $displayer = new $abstract($value, $grid, $column, $this); |
1077 | 1077 |
@@ -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 | { |