@@ -1,12 +1,12 @@ |
||
1 | 1 | @if(Session::has('error')) |
2 | - <?php $error = Session::get('error');?> |
|
2 | + <?php $error = Session::get('error'); ?> |
|
3 | 3 | <div class="alert alert-danger alert-dismissable"> |
4 | 4 | <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button> |
5 | 5 | <h4><i class="icon fa fa-ban"></i>{{ array_get($error->get('title'), 0) }}</h4> |
6 | 6 | <p>{!! array_get($error->get('message'), 0) !!}</p> |
7 | 7 | </div> |
8 | 8 | @elseif (Session::has('errors')) |
9 | - <?php $errors = Session::get('errors');?> |
|
9 | + <?php $errors = Session::get('errors'); ?> |
|
10 | 10 | @if ($errors->hasBag('error')) |
11 | 11 | <div class="alert alert-danger alert-dismissable"> |
12 | 12 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | return $next($request); |
34 | 34 | } |
35 | 35 | |
36 | - if (!Admin::user()->allPermissions()->first(function ($permission) use ($request) { |
|
36 | + if (!Admin::user()->allPermissions()->first(function($permission) use ($request) { |
|
37 | 37 | return $permission->shouldPassThrough($request); |
38 | 38 | })) { |
39 | 39 | Checker::error(); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public function checkRoutePermission(Request $request) |
54 | 54 | { |
55 | - if (!$middleware = collect($request->route()->middleware())->first(function ($middleware) { |
|
55 | + if (!$middleware = collect($request->route()->middleware())->first(function($middleware) { |
|
56 | 56 | return Str::startsWith($middleware, $this->middlewarePrefix); |
57 | 57 | })) { |
58 | 58 | return false; |
@@ -86,7 +86,7 @@ |
||
86 | 86 | { |
87 | 87 | parent::boot(); |
88 | 88 | |
89 | - static::deleting(function ($model) { |
|
89 | + static::deleting(function($model) { |
|
90 | 90 | $model->administrators()->detach(); |
91 | 91 | |
92 | 92 | $model->permissions()->detach(); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | $method = $this->http_method; |
68 | 68 | |
69 | - $matches = array_map(function ($path) use ($method) { |
|
69 | + $matches = array_map(function($path) use ($method) { |
|
70 | 70 | $path = trim(config('admin.route.prefix'), '/').$path; |
71 | 71 | |
72 | 72 | if (Str::contains($path, ':')) { |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | return false; |
101 | 101 | } |
102 | 102 | |
103 | - $method = collect($match['method'])->filter()->map(function ($method) { |
|
103 | + $method = collect($match['method'])->filter()->map(function($method) { |
|
104 | 104 | return strtoupper($method); |
105 | 105 | }); |
106 | 106 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | { |
141 | 141 | parent::boot(); |
142 | 142 | |
143 | - static::deleting(function ($model) { |
|
143 | + static::deleting(function($model) { |
|
144 | 144 | $model->roles()->detach(); |
145 | 145 | }); |
146 | 146 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | * Get or set option for grid. |
230 | 230 | * |
231 | 231 | * @param string $key |
232 | - * @param mixed $value |
|
232 | + * @param boolean $value |
|
233 | 233 | * |
234 | 234 | * @return $this|mixed |
235 | 235 | */ |
@@ -286,6 +286,9 @@ discard block |
||
286 | 286 | return $column; |
287 | 287 | } |
288 | 288 | |
289 | + /** |
|
290 | + * @return string |
|
291 | + */ |
|
289 | 292 | public function setLabel($label , $relationColumn) |
290 | 293 | { |
291 | 294 | $trans_key = 'validation.attributes.' . $relationColumn; |
@@ -374,7 +377,7 @@ discard block |
||
374 | 377 | /** |
375 | 378 | * Get the grid paginator. |
376 | 379 | * |
377 | - * @return mixed |
|
380 | + * @return Tools\Paginator |
|
378 | 381 | */ |
379 | 382 | public function paginator() |
380 | 383 | { |
@@ -750,7 +753,7 @@ discard block |
||
750 | 753 | * |
751 | 754 | * @param Closure|null $closure |
752 | 755 | * |
753 | - * @return $this|Tools\Footer |
|
756 | + * @return callable |
|
754 | 757 | */ |
755 | 758 | public function footer(Closure $closure = null) |
756 | 759 | { |
@@ -290,14 +290,14 @@ |
||
290 | 290 | { |
291 | 291 | $trans_key = 'validation.attributes.' . $relationColumn; |
292 | 292 | $trans_key_low = strtolower($trans_key); |
293 | - if (empty($label) && Lang::has($trans_key)) { |
|
294 | - $label = Lang::get($trans_key); |
|
295 | - } |
|
296 | - if (empty($label) && Lang::has($trans_key_low)) { |
|
293 | + if (empty($label) && Lang::has($trans_key)) { |
|
294 | + $label = Lang::get($trans_key); |
|
295 | + } |
|
296 | + if (empty($label) && Lang::has($trans_key_low)) { |
|
297 | 297 | $label = Lang::get($trans_key_low); |
298 | 298 | }else if (empty($label)) { |
299 | - $label = ucfirst($relationColumn); |
|
300 | - } |
|
299 | + $label = ucfirst($relationColumn); |
|
300 | + } |
|
301 | 301 | return $label; |
302 | 302 | } |
303 | 303 |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | |
272 | 272 | $relation = $this->model()->eloquent()->$relationName(); |
273 | 273 | |
274 | - $label = $this->setLabel($label,$relationColumn); |
|
274 | + $label = $this->setLabel($label, $relationColumn); |
|
275 | 275 | // $label = empty($label) ? ucfirst($relationColumn) : $label; |
276 | 276 | $name = snake_case($relationName).'.'.$relationColumn; |
277 | 277 | } |
@@ -286,16 +286,16 @@ discard block |
||
286 | 286 | return $column; |
287 | 287 | } |
288 | 288 | |
289 | - public function setLabel($label , $relationColumn) |
|
289 | + public function setLabel($label, $relationColumn) |
|
290 | 290 | { |
291 | - $trans_key = 'validation.attributes.' . $relationColumn; |
|
291 | + $trans_key = 'validation.attributes.'.$relationColumn; |
|
292 | 292 | $trans_key_low = strtolower($trans_key); |
293 | 293 | if (empty($label) && Lang::has($trans_key)) { |
294 | 294 | $label = Lang::get($trans_key); |
295 | 295 | } |
296 | 296 | if (empty($label) && Lang::has($trans_key_low)) { |
297 | 297 | $label = Lang::get($trans_key_low); |
298 | - }else if (empty($label)) { |
|
298 | + } else if (empty($label)) { |
|
299 | 299 | $label = ucfirst($relationColumn); |
300 | 300 | } |
301 | 301 | return $label; |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | $callback = $this->actionsCallback; |
455 | 455 | $column = $this->addColumn('__actions__', trans('admin.action')); |
456 | 456 | |
457 | - $column->display(function ($value) use ($grid, $column, $callback) { |
|
457 | + $column->display(function($value) use ($grid, $column, $callback) { |
|
458 | 458 | $actions = new Actions($value, $grid, $column, $this); |
459 | 459 | |
460 | 460 | return $actions->display($callback); |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | */ |
469 | 469 | public function disableRowSelector() |
470 | 470 | { |
471 | - $this->tools(function ($tools) { |
|
471 | + $this->tools(function($tools) { |
|
472 | 472 | /* @var Grid\Tools $tools */ |
473 | 473 | $tools->disableBatchActions(); |
474 | 474 | }); |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | $column = new Column(Column::SELECT_COLUMN_NAME, ' '); |
493 | 493 | $column->setGrid($this); |
494 | 494 | |
495 | - $column->display(function ($value) use ($grid, $column) { |
|
495 | + $column->display(function($value) use ($grid, $column) { |
|
496 | 496 | $actions = new RowSelector($value, $grid, $column, $this); |
497 | 497 | |
498 | 498 | return $actions->display(); |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | |
520 | 520 | Column::setOriginalGridData($data); |
521 | 521 | |
522 | - $this->columns->map(function (Column $column) use (&$data) { |
|
522 | + $this->columns->map(function(Column $column) use (&$data) { |
|
523 | 523 | $data = $column->fill($data); |
524 | 524 | |
525 | 525 | $this->columnNames[] = $column->getName(); |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | */ |
598 | 598 | protected function buildRows(array $data) |
599 | 599 | { |
600 | - $this->rows = collect($data)->map(function ($model, $number) { |
|
600 | + $this->rows = collect($data)->map(function($model, $number) { |
|
601 | 601 | return new Row($number, $model); |
602 | 602 | }); |
603 | 603 | |
@@ -895,7 +895,7 @@ discard block |
||
895 | 895 | public function __call($method, $arguments) |
896 | 896 | { |
897 | 897 | $label = isset($arguments[0]) ? $arguments[0] : null; |
898 | - $label = $this->setLabel($label,$method); |
|
898 | + $label = $this->setLabel($label, $method); |
|
899 | 899 | |
900 | 900 | if ($this->model()->eloquent() instanceof MongodbModel) { |
901 | 901 | return $this->addColumn($method, $label); |
@@ -295,7 +295,7 @@ |
||
295 | 295 | } |
296 | 296 | if (empty($label) && Lang::has($trans_key_low)) { |
297 | 297 | $label = Lang::get($trans_key_low); |
298 | - }else if (empty($label)) { |
|
298 | + } else if (empty($label)) { |
|
299 | 299 | $label = ucfirst($relationColumn); |
300 | 300 | } |
301 | 301 | return $label; |
@@ -106,6 +106,10 @@ discard block |
||
106 | 106 | { |
107 | 107 | $this->setPresenter(new Text($this->label)); |
108 | 108 | } |
109 | + |
|
110 | + /** |
|
111 | + * @param string $label |
|
112 | + */ |
|
109 | 113 | public function setLabel($label) |
110 | 114 | { |
111 | 115 | $trans_key = 'validation.attributes.' . $label; |
@@ -350,7 +354,7 @@ discard block |
||
350 | 354 | * |
351 | 355 | * @param Presenter $presenter |
352 | 356 | * |
353 | - * @return mixed |
|
357 | + * @return Presenter |
|
354 | 358 | */ |
355 | 359 | protected function setPresenter(Presenter $presenter) |
356 | 360 | { |
@@ -108,14 +108,14 @@ discard block |
||
108 | 108 | } |
109 | 109 | public function setLabel($label) |
110 | 110 | { |
111 | - $trans_key = 'validation.attributes.' . $label; |
|
111 | + $trans_key = 'validation.attributes.'.$label; |
|
112 | 112 | $trans_key_low = strtolower($trans_key); |
113 | 113 | if (Lang::has($trans_key)) { |
114 | 114 | $label = Lang::get($trans_key); |
115 | 115 | } |
116 | 116 | if (Lang::has($trans_key_low)) { |
117 | 117 | $label = Lang::get($trans_key_low); |
118 | - }else { |
|
118 | + } else { |
|
119 | 119 | $label = ucfirst($label); |
120 | 120 | } |
121 | 121 | return $label; |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | |
443 | 443 | list($relation, $args[0]) = explode('.', $this->column); |
444 | 444 | |
445 | - return ['whereHas' => [$relation, function ($relation) use ($args) { |
|
445 | + return ['whereHas' => [$relation, function($relation) use ($args) { |
|
446 | 446 | call_user_func_array([$relation, $this->query], $args); |
447 | 447 | }]]; |
448 | 448 | } |
@@ -558,7 +558,7 @@ |
||
558 | 558 | } |
559 | 559 | if (Lang::has($trans_key_low)) { |
560 | 560 | $label = Lang::get($trans_key_low); |
561 | - }else { |
|
561 | + } else { |
|
562 | 562 | $label = ucfirst($label); |
563 | 563 | } |
564 | 564 | return $label; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | { |
48 | 48 | $fields = $this->collectFields($content); |
49 | 49 | |
50 | - $id = 'form-' . ($this->tabs->count() + 1); |
|
50 | + $id = 'form-'.($this->tabs->count() + 1); |
|
51 | 51 | //if define tab and row inside of tab ,you cant define row in form or simple field in tab |
52 | 52 | $rows = $this->form->builder()->getRows(); |
53 | 53 | $this->form->builder()->setRows([]); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | public function getTabs() |
85 | 85 | { |
86 | 86 | // If there is no active tab, then active the first. |
87 | - if ($this->tabs->filter(function ($tab) { |
|
87 | + if ($this->tabs->filter(function($tab) { |
|
88 | 88 | return $tab['active']; |
89 | 89 | })->isEmpty()) { |
90 | 90 | $first = $this->tabs->first(); |
@@ -78,7 +78,7 @@ |
||
78 | 78 | { |
79 | 79 | static::treeBoot(); |
80 | 80 | |
81 | - static::deleting(function ($model) { |
|
81 | + static::deleting(function($model) { |
|
82 | 82 | $model->roles()->detach(); |
83 | 83 | }); |
84 | 84 | } |
@@ -26,6 +26,9 @@ discard block |
||
26 | 26 | return $this; |
27 | 27 | } |
28 | 28 | |
29 | + /** |
|
30 | + * @param string $string |
|
31 | + */ |
|
29 | 32 | public function prepend($string) |
30 | 33 | { |
31 | 34 | if (is_null($this->prepend)) { |
@@ -35,6 +38,9 @@ discard block |
||
35 | 38 | return $this; |
36 | 39 | } |
37 | 40 | |
41 | + /** |
|
42 | + * @param string $string |
|
43 | + */ |
|
38 | 44 | public function append($string) |
39 | 45 | { |
40 | 46 | if (is_null($this->append)) { |
@@ -51,6 +57,9 @@ discard block |
||
51 | 57 | } |
52 | 58 | } |
53 | 59 | |
60 | + /** |
|
61 | + * @param string $attribute |
|
62 | + */ |
|
54 | 63 | protected function defaultAttribute($attribute, $value) |
55 | 64 | { |
56 | 65 | if (!array_key_exists($attribute, $this->attributes)) { |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | public function prependIcon($icon, $class = "") |
12 | 12 | { |
13 | 13 | if (is_null($this->prepend)) { |
14 | - $this->prepend = '<i class="fa fa-' . $icon . " " . $class . '"></i>'; |
|
14 | + $this->prepend = '<i class="fa fa-'.$icon." ".$class.'"></i>'; |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | return $this; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | public function appendIcon($icon, $class = "") |
21 | 21 | { |
22 | 22 | if (is_null($this->append)) { |
23 | - $this->append = '<i class="fa fa-' . $icon . " " . $class . '"></i>'; |
|
23 | + $this->append = '<i class="fa fa-'.$icon." ".$class.'"></i>'; |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | return $this; |