@@ -31,7 +31,7 @@ |
||
31 | 31 | * Generate thumbnail URL. |
32 | 32 | * |
33 | 33 | * @param $image |
34 | - * @param $type |
|
34 | + * @param string $type |
|
35 | 35 | * |
36 | 36 | * @return string |
37 | 37 | */ |
@@ -54,7 +54,7 @@ |
||
54 | 54 | * |
55 | 55 | * @param bool $toArray |
56 | 56 | * |
57 | - * @return array|Collection|mixed |
|
57 | + * @return Collection |
|
58 | 58 | */ |
59 | 59 | public function applyFilter($toArray = true) |
60 | 60 | { |
@@ -125,14 +125,14 @@ |
||
125 | 125 | */ |
126 | 126 | protected function parseQueryBindings(array $queries) |
127 | 127 | { |
128 | - $columnMap = $this->columns->mapWithKeys(function (Column $column) { |
|
128 | + $columnMap = $this->columns->mapWithKeys(function(Column $column) { |
|
129 | 129 | $label = $column->getLabel(); |
130 | 130 | $name = $column->getName(); |
131 | 131 | |
132 | 132 | return [$label => $name, $name => $name]; |
133 | 133 | }); |
134 | 134 | |
135 | - return collect($queries)->map(function ($query) use ($columnMap) { |
|
135 | + return collect($queries)->map(function($query) use ($columnMap) { |
|
136 | 136 | $segments = explode(':', $query, 2); |
137 | 137 | |
138 | 138 | if (count($segments) != 2) { |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | $show = $this->grid->visibleColumnNames(); |
48 | 48 | |
49 | - $lists = $this->getGridColumns()->map(function ($label, $key) use ($show) { |
|
49 | + $lists = $this->getGridColumns()->map(function($label, $key) use ($show) { |
|
50 | 50 | if (empty($show)) { |
51 | 51 | $checked = 'checked'; |
52 | 52 | } else { |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | protected function getGridColumns() |
100 | 100 | { |
101 | - return $this->grid->columns()->map(function (Grid\Column $column) { |
|
101 | + return $this->grid->columns()->map(function(Grid\Column $column) { |
|
102 | 102 | $name = $column->getName(); |
103 | 103 | |
104 | 104 | if ($this->isColumnIgnored($name)) { |
@@ -13,7 +13,7 @@ |
||
13 | 13 | $this->value = $this->value->toArray(); |
14 | 14 | } |
15 | 15 | |
16 | - return collect((array) $this->value)->map(function ($item) use ($style) { |
|
16 | + return collect((array) $this->value)->map(function($item) use ($style) { |
|
17 | 17 | if (is_array($style)) { |
18 | 18 | $style = Arr::get($style, $this->getColumn()->getOriginal(), 'success'); |
19 | 19 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | $this->value = $this->value->toArray(); |
14 | 14 | } |
15 | 15 | |
16 | - return collect((array) $this->value)->map(function ($name) use ($style) { |
|
16 | + return collect((array) $this->value)->map(function($name) use ($style) { |
|
17 | 17 | if (is_array($style)) { |
18 | 18 | $style = Arr::get($style, $this->getColumn()->getOriginal(), 'red'); |
19 | 19 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | $this->value = $this->value->toArray(); |
14 | 14 | } |
15 | 15 | |
16 | - return collect((array) $this->value)->filter()->map(function ($value) use ($server) { |
|
16 | + return collect((array) $this->value)->filter()->map(function($value) use ($server) { |
|
17 | 17 | if (empty($value)) { |
18 | 18 | return ''; |
19 | 19 | } |
@@ -111,6 +111,9 @@ discard block |
||
111 | 111 | ]; |
112 | 112 | } |
113 | 113 | |
114 | + /** |
|
115 | + * @param string $permission |
|
116 | + */ |
|
114 | 117 | private function generateHttpMethod($permission) |
115 | 118 | { |
116 | 119 | switch ($permission) { |
@@ -132,6 +135,9 @@ discard block |
||
132 | 135 | return $http_method; |
133 | 136 | } |
134 | 137 | |
138 | + /** |
|
139 | + * @param string $permission |
|
140 | + */ |
|
135 | 141 | private function generateHttpPath($table, $permission) |
136 | 142 | { |
137 | 143 | $resource = Str::kebab(Str::camel($table)); |
@@ -158,6 +164,9 @@ discard block |
||
158 | 164 | return $http_path; |
159 | 165 | } |
160 | 166 | |
167 | + /** |
|
168 | + * @param string $permission |
|
169 | + */ |
|
161 | 170 | private function generateSlug($table, $permission) |
162 | 171 | { |
163 | 172 | return Str::kebab(Str::camel($table)) . '.' . $permission; |
@@ -137,19 +137,19 @@ discard block |
||
137 | 137 | $resource = Str::kebab(Str::camel($table)); |
138 | 138 | switch ($permission) { |
139 | 139 | case 'create': |
140 | - $http_path = '/' . $resource; |
|
140 | + $http_path = '/'.$resource; |
|
141 | 141 | break; |
142 | 142 | case 'edit': |
143 | - $http_path = '/' . $resource . '/*'; |
|
143 | + $http_path = '/'.$resource.'/*'; |
|
144 | 144 | break; |
145 | 145 | case 'delete': |
146 | - $http_path = '/' . $resource . '/*'; |
|
146 | + $http_path = '/'.$resource.'/*'; |
|
147 | 147 | break; |
148 | 148 | case 'index': |
149 | - $http_path = '/' . $resource; |
|
149 | + $http_path = '/'.$resource; |
|
150 | 150 | break; |
151 | 151 | case 'view': |
152 | - $http_path = '/' . $resource . '/*'; |
|
152 | + $http_path = '/'.$resource.'/*'; |
|
153 | 153 | break; |
154 | 154 | default: |
155 | 155 | $http_path = ''; |
@@ -160,11 +160,11 @@ discard block |
||
160 | 160 | |
161 | 161 | private function generateSlug($table, $permission) |
162 | 162 | { |
163 | - return Str::kebab(Str::camel($table)) . '.' . $permission; |
|
163 | + return Str::kebab(Str::camel($table)).'.'.$permission; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | private function generateName($table, $permission_lang) |
167 | 167 | { |
168 | - return Str::upper(Str::kebab(Str::camel($table))) . $permission_lang; |
|
168 | + return Str::upper(Str::kebab(Str::camel($table))).$permission_lang; |
|
169 | 169 | } |
170 | 170 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | /** |
140 | 140 | * Extend column displayer. |
141 | 141 | * |
142 | - * @param $name |
|
142 | + * @param string $name |
|
143 | 143 | * @param $displayer |
144 | 144 | */ |
145 | 145 | public static function extend($name, $displayer) |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | /** |
174 | 174 | * Set model for column. |
175 | 175 | * |
176 | - * @param $model |
|
176 | + * @param Model $model |
|
177 | 177 | */ |
178 | 178 | public function setModel($model) |
179 | 179 | { |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | /** |
258 | 258 | * Get original column value. |
259 | 259 | * |
260 | - * @return mixed |
|
260 | + * @return string |
|
261 | 261 | */ |
262 | 262 | public function getOriginal() |
263 | 263 | { |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | /** |
268 | 268 | * Get name of this column. |
269 | 269 | * |
270 | - * @return mixed |
|
270 | + * @return string |
|
271 | 271 | */ |
272 | 272 | public function getName() |
273 | 273 | { |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | /** |
296 | 296 | * Get label of the column. |
297 | 297 | * |
298 | - * @return mixed |
|
298 | + * @return string |
|
299 | 299 | */ |
300 | 300 | public function getLabel() |
301 | 301 | { |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | * Display using display abstract. |
397 | 397 | * |
398 | 398 | * @param string $abstract |
399 | - * @param array $arguments |
|
399 | + * @param Closure[] $arguments |
|
400 | 400 | * |
401 | 401 | * @return $this |
402 | 402 | */ |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | */ |
326 | 326 | protected function isRelation() |
327 | 327 | { |
328 | - return (bool)$this->relation; |
|
328 | + return (bool) $this->relation; |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | |
407 | 407 | $column = $this; |
408 | 408 | |
409 | - return $this->display(function ($value) use ($grid, $column, $abstract, $arguments) { |
|
409 | + return $this->display(function($value) use ($grid, $column, $abstract, $arguments) { |
|
410 | 410 | /** @var AbstractDisplayer $displayer */ |
411 | 411 | $displayer = new $abstract($value, $grid, $column, $this); |
412 | 412 | |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | */ |
425 | 425 | public function using(array $values, $default = null) |
426 | 426 | { |
427 | - return $this->display(function ($value) use ($values, $default) { |
|
427 | + return $this->display(function($value) use ($values, $default) { |
|
428 | 428 | if (is_null($value)) { |
429 | 429 | return $default; |
430 | 430 | } |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | */ |
443 | 443 | public function replace(array $replacements) |
444 | 444 | { |
445 | - return $this->display(function ($value) use ($replacements) { |
|
445 | + return $this->display(function($value) use ($replacements) { |
|
446 | 446 | if (isset($replacements[$value])) { |
447 | 447 | return $replacements[$value]; |
448 | 448 | } |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | */ |
461 | 461 | public function view($view) |
462 | 462 | { |
463 | - return $this->display(function ($value) use ($view) { |
|
463 | + return $this->display(function($value) use ($view) { |
|
464 | 464 | $model = $this; |
465 | 465 | |
466 | 466 | return view($view, compact('model', 'value'))->render(); |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | */ |
501 | 501 | public function filesize() |
502 | 502 | { |
503 | - return $this->display(function ($value) { |
|
503 | + return $this->display(function($value) { |
|
504 | 504 | return file_size($value); |
505 | 505 | }); |
506 | 506 | } |
@@ -514,7 +514,7 @@ discard block |
||
514 | 514 | */ |
515 | 515 | public function gravatar($size = 30) |
516 | 516 | { |
517 | - return $this->display(function ($value) use ($size) { |
|
517 | + return $this->display(function($value) use ($size) { |
|
518 | 518 | $src = sprintf( |
519 | 519 | 'https://www.gravatar.com/avatar/%s?s=%d', |
520 | 520 | md5(strtolower($value)), |
@@ -535,8 +535,8 @@ discard block |
||
535 | 535 | */ |
536 | 536 | public function loading($values = [], $others = []) |
537 | 537 | { |
538 | - return $this->display(function ($value) use ($values, $others) { |
|
539 | - $values = (array)$values; |
|
538 | + return $this->display(function($value) use ($values, $others) { |
|
539 | + $values = (array) $values; |
|
540 | 540 | |
541 | 541 | if (in_array($value, $values)) { |
542 | 542 | return '<i class="fa fa-refresh fa-spin text-primary"></i>'; |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | */ |
557 | 557 | public function icon(array $setting, $default = '') |
558 | 558 | { |
559 | - return $this->display(function ($value) use ($setting, $default) { |
|
559 | + return $this->display(function($value) use ($setting, $default) { |
|
560 | 560 | $fa = ''; |
561 | 561 | |
562 | 562 | if (isset($setting[$value])) { |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | Carbon::setLocale($locale); |
583 | 583 | } |
584 | 584 | |
585 | - return $this->display(function ($value) { |
|
585 | + return $this->display(function($value) { |
|
586 | 586 | return Carbon::parse($value)->diffForHumans(); |
587 | 587 | }); |
588 | 588 | } |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | $grid = $this->grid; |
704 | 704 | $column = $this; |
705 | 705 | |
706 | - $this->display(function ($value) use ($grid, $column, $class) { |
|
706 | + $this->display(function($value) use ($grid, $column, $class) { |
|
707 | 707 | /** @var AbstractDisplayer $definition */ |
708 | 708 | $definition = new $class($value, $grid, $column, $this); |
709 | 709 | |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | protected function htmlEntityEncode($item) |
722 | 722 | { |
723 | 723 | if (is_array($item)) { |
724 | - array_walk_recursive($item, function (&$value) { |
|
724 | + array_walk_recursive($item, function(&$value) { |
|
725 | 725 | $value = htmlentities($value); |
726 | 726 | }); |
727 | 727 | } else { |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | */ |
759 | 759 | protected function callSupportDisplayer($abstract, $arguments) |
760 | 760 | { |
761 | - return $this->display(function ($value) use ($abstract, $arguments) { |
|
761 | + return $this->display(function($value) use ($abstract, $arguments) { |
|
762 | 762 | if (is_array($value) || $value instanceof Arrayable) { |
763 | 763 | return call_user_func_array([collect($value), $abstract], $arguments); |
764 | 764 | } |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | protected function callBuiltinDisplayer($abstract, $arguments) |
783 | 783 | { |
784 | 784 | if ($abstract instanceof Closure) { |
785 | - return $this->display(function ($value) use ($abstract, $arguments) { |
|
785 | + return $this->display(function($value) use ($abstract, $arguments) { |
|
786 | 786 | return $abstract->call($this, ...array_merge([$value], $arguments)); |
787 | 787 | }); |
788 | 788 | } |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | $grid = $this->grid; |
792 | 792 | $column = $this; |
793 | 793 | |
794 | - return $this->display(function ($value) use ($abstract, $grid, $column, $arguments) { |
|
794 | + return $this->display(function($value) use ($abstract, $grid, $column, $arguments) { |
|
795 | 795 | /** @var AbstractDisplayer $displayer */ |
796 | 796 | $displayer = new $abstract($value, $grid, $column, $this); |
797 | 797 |