@@ -107,6 +107,7 @@ |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
110 | + * @param string $name |
|
110 | 111 | * @return string |
111 | 112 | */ |
112 | 113 | protected function elementNameWithPrefix($name) |
@@ -52,7 +52,7 @@ |
||
52 | 52 | /** |
53 | 53 | * Add a batch action. |
54 | 54 | * |
55 | - * @param $title |
|
55 | + * @param BatchDelete $title |
|
56 | 56 | * @param BatchAction|null $action |
57 | 57 | * @return $this |
58 | 58 | */ |
@@ -317,7 +317,7 @@ |
||
317 | 317 | * @param string $method |
318 | 318 | * @param array $arguments |
319 | 319 | * |
320 | - * @return bool|mixed |
|
320 | + * @return Field |
|
321 | 321 | */ |
322 | 322 | public function __call($method, $arguments = []) |
323 | 323 | { |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | $this->overwriteExistingField($name); |
185 | 185 | |
186 | - return tap($field, function ($field) { |
|
186 | + return tap($field, function($field) { |
|
187 | 187 | $this->fields->push($field); |
188 | 188 | }); |
189 | 189 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | |
206 | 206 | $this->overwriteExistingRelation($name); |
207 | 207 | |
208 | - return tap($relation, function ($relation) { |
|
208 | + return tap($relation, function($relation) { |
|
209 | 209 | $this->relations->push($relation); |
210 | 210 | }); |
211 | 211 | } |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | } |
223 | 223 | |
224 | 224 | $this->fields = $this->fields->filter( |
225 | - function (Field $field) use ($name) { |
|
225 | + function(Field $field) use ($name) { |
|
226 | 226 | return $field->getName() != $name; |
227 | 227 | } |
228 | 228 | ); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | } |
241 | 241 | |
242 | 242 | $this->relations = $this->relations->filter( |
243 | - function (Relation $relation) use ($name) { |
|
243 | + function(Relation $relation) use ($name) { |
|
244 | 244 | return $relation->getName() != $name; |
245 | 245 | } |
246 | 246 | ); |
@@ -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 | { |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public function values(array $values, $default = null) |
145 | 145 | { |
146 | - return $this->as(function ($value) use ($values, $default) { |
|
146 | + return $this->as(function($value) use ($values, $default) { |
|
147 | 147 | return array_get($values, $value, $default); |
148 | 148 | }); |
149 | 149 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function image($server = '', $width = 200, $height = 200) |
161 | 161 | { |
162 | - return $this->as(function ($path) use ($server, $width, $height) { |
|
162 | + return $this->as(function($path) use ($server, $width, $height) { |
|
163 | 163 | if (url()->isValidUrl($path)) { |
164 | 164 | $src = $path; |
165 | 165 | } elseif ($server) { |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | */ |
183 | 183 | public function link($href = '', $target = '_blank') |
184 | 184 | { |
185 | - return $this->as(function ($link) use ($href, $target) { |
|
185 | + return $this->as(function($link) use ($href, $target) { |
|
186 | 186 | $href = $href ?: $link; |
187 | 187 | |
188 | 188 | return "<a href='$href' target='{$target}'>{$link}</a>"; |
@@ -198,12 +198,12 @@ discard block |
||
198 | 198 | */ |
199 | 199 | public function label($style = 'success') |
200 | 200 | { |
201 | - return $this->as(function ($value) use ($style) { |
|
201 | + return $this->as(function($value) use ($style) { |
|
202 | 202 | if ($value instanceof Arrayable) { |
203 | 203 | $value = $value->toArray(); |
204 | 204 | } |
205 | 205 | |
206 | - return collect((array) $value)->map(function ($name) use ($style) { |
|
206 | + return collect((array) $value)->map(function($name) use ($style) { |
|
207 | 207 | return "<span class='label label-{$style}'>$name</span>"; |
208 | 208 | })->implode(' '); |
209 | 209 | }); |
@@ -218,12 +218,12 @@ discard block |
||
218 | 218 | */ |
219 | 219 | public function badge($style = 'blue') |
220 | 220 | { |
221 | - return $this->as(function ($value) use ($style) { |
|
221 | + return $this->as(function($value) use ($style) { |
|
222 | 222 | if ($value instanceof Arrayable) { |
223 | 223 | $value = $value->toArray(); |
224 | 224 | } |
225 | 225 | |
226 | - return collect((array) $value)->map(function ($name) use ($style) { |
|
226 | + return collect((array) $value)->map(function($name) use ($style) { |
|
227 | 227 | return "<span class='badge bg-{$style}'>$name</span>"; |
228 | 228 | })->implode(' '); |
229 | 229 | }); |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | public function render() |
290 | 290 | { |
291 | 291 | if ($this->showAs->isNotEmpty()) { |
292 | - $this->showAs->each(function ($callable) { |
|
292 | + $this->showAs->each(function($callable) { |
|
293 | 293 | $this->value = $callable->call( |
294 | 294 | $this->parent->getModel(), |
295 | 295 | $this->value |
@@ -138,7 +138,7 @@ |
||
138 | 138 | /** |
139 | 139 | * Fill fields to panel. |
140 | 140 | * |
141 | - * @param []Field $fields |
|
141 | + * @param Collection $fields |
|
142 | 142 | * |
143 | 143 | * @return $this |
144 | 144 | */ |
@@ -106,7 +106,7 @@ |
||
106 | 106 | */ |
107 | 107 | public function title($title) |
108 | 108 | { |
109 | - $this->data['title'] = $title; |
|
109 | + $this->data['title'] = $title; |
|
110 | 110 | |
111 | 111 | return $this; |
112 | 112 | } |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | $callback = $this->actionsCallback; |
444 | 444 | $column = $this->addColumn('__actions__', trans('admin.action')); |
445 | 445 | |
446 | - $column->display(function ($value) use ($grid, $column, $callback) { |
|
446 | + $column->display(function($value) use ($grid, $column, $callback) { |
|
447 | 447 | $actions = new Actions($value, $grid, $column, $this); |
448 | 448 | |
449 | 449 | return $actions->display($callback); |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | */ |
458 | 458 | public function disableRowSelector() |
459 | 459 | { |
460 | - $this->tools(function ($tools) { |
|
460 | + $this->tools(function($tools) { |
|
461 | 461 | /* @var Grid\Tools $tools */ |
462 | 462 | $tools->disableBatchActions(); |
463 | 463 | }); |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | $column = new Column(Column::SELECT_COLUMN_NAME, ' '); |
482 | 482 | $column->setGrid($this); |
483 | 483 | |
484 | - $column->display(function ($value) use ($grid, $column) { |
|
484 | + $column->display(function($value) use ($grid, $column) { |
|
485 | 485 | $actions = new RowSelector($value, $grid, $column, $this); |
486 | 486 | |
487 | 487 | return $actions->display(); |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | |
509 | 509 | Column::setOriginalGridData($data); |
510 | 510 | |
511 | - $this->columns->map(function (Column $column) use (&$data) { |
|
511 | + $this->columns->map(function(Column $column) use (&$data) { |
|
512 | 512 | $data = $column->fill($data); |
513 | 513 | |
514 | 514 | $this->columnNames[] = $column->getName(); |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | */ |
587 | 587 | protected function buildRows(array $data) |
588 | 588 | { |
589 | - $this->rows = collect($data)->map(function ($model, $number) { |
|
589 | + $this->rows = collect($data)->map(function($model, $number) { |
|
590 | 590 | return new Row($number, $model); |
591 | 591 | }); |
592 | 592 | |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | |
682 | 682 | return sprintf('%s/create%s', |
683 | 683 | $this->resource(), |
684 | - $queryString ? ('?' . $queryString) : '' |
|
684 | + $queryString ? ('?'.$queryString) : '' |
|
685 | 685 | ); |
686 | 686 | } |
687 | 687 |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | protected function getListPath() |
137 | 137 | { |
138 | - return '/' . ltrim($this->getResource(), '/'); |
|
138 | + return '/'.ltrim($this->getResource(), '/'); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | { |
148 | 148 | $key = $this->panel->getParent()->getModel()->getKey(); |
149 | 149 | |
150 | - return $this->getListPath() . '/' . $key . '/edit'; |
|
150 | + return $this->getListPath().'/'.$key.'/edit'; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | { |
160 | 160 | $key = $this->panel->getParent()->getModel()->getKey(); |
161 | 161 | |
162 | - return $this->getListPath() . '/' . $key; |
|
162 | + return $this->getListPath().'/'.$key; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -266,10 +266,10 @@ discard block |
||
266 | 266 | $output = implode('', $this->prepends); |
267 | 267 | |
268 | 268 | foreach ($this->tools as $tool) { |
269 | - $renderMethod = 'render' . ucfirst($tool); |
|
269 | + $renderMethod = 'render'.ucfirst($tool); |
|
270 | 270 | $output .= $this->$renderMethod(); |
271 | 271 | } |
272 | 272 | |
273 | - return $output . implode('', $this->appends); |
|
273 | + return $output.implode('', $this->appends); |
|
274 | 274 | } |
275 | 275 | } |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | */ |
312 | 312 | public function values(array $values, $default = null) |
313 | 313 | { |
314 | - return $this->display(function ($value) use ($values, $default) { |
|
314 | + return $this->display(function($value) use ($values, $default) { |
|
315 | 315 | return array_get($values, $value, $default); |
316 | 316 | }); |
317 | 317 | } |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | $grid = $this->grid; |
424 | 424 | $column = $this; |
425 | 425 | |
426 | - $this->display(function ($value) use ($grid, $column, $class) { |
|
426 | + $this->display(function($value) use ($grid, $column, $class) { |
|
427 | 427 | $definition = new $class($value, $grid, $column, $this); |
428 | 428 | |
429 | 429 | return $definition->display(); |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | protected function htmlEntityEncode($item) |
441 | 441 | { |
442 | 442 | if (is_array($item)) { |
443 | - array_walk_recursive($item, function (&$value) { |
|
443 | + array_walk_recursive($item, function(&$value) { |
|
444 | 444 | $value = htmlentities($value); |
445 | 445 | }); |
446 | 446 | } else { |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | */ |
521 | 521 | protected function callSupportDisplayer($abstract, $arguments) |
522 | 522 | { |
523 | - return $this->display(function ($value) use ($abstract, $arguments) { |
|
523 | + return $this->display(function($value) use ($abstract, $arguments) { |
|
524 | 524 | if (is_array($value) || $value instanceof Arrayable) { |
525 | 525 | return call_user_func_array([collect($value), $abstract], $arguments); |
526 | 526 | } |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | protected function callBuiltinDisplayer($abstract, $arguments) |
545 | 545 | { |
546 | 546 | if ($abstract instanceof Closure) { |
547 | - return $this->display(function ($value) use ($abstract, $arguments) { |
|
547 | + return $this->display(function($value) use ($abstract, $arguments) { |
|
548 | 548 | return $abstract->call($this, ...array_merge([$value], $arguments)); |
549 | 549 | }); |
550 | 550 | } |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | $grid = $this->grid; |
554 | 554 | $column = $this; |
555 | 555 | |
556 | - return $this->display(function ($value) use ($abstract, $grid, $column, $arguments) { |
|
556 | + return $this->display(function($value) use ($abstract, $grid, $column, $arguments) { |
|
557 | 557 | $displayer = new $abstract($value, $grid, $column, $this); |
558 | 558 | |
559 | 559 | return call_user_func_array([$displayer, 'display'], $arguments); |
@@ -128,7 +128,7 @@ |
||
128 | 128 | $actions = $this->prepends; |
129 | 129 | |
130 | 130 | foreach ($this->actions as $action) { |
131 | - $method = 'render' . ucfirst($action); |
|
131 | + $method = 'render'.ucfirst($action); |
|
132 | 132 | array_push($actions, $this->{$method}()); |
133 | 133 | } |
134 | 134 |