@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | */ |
334 | 334 | public function isCreatable() |
335 | 335 | { |
336 | - if (! is_callable($this->getCreate())) { |
|
336 | + if (!is_callable($this->getCreate())) { |
|
337 | 337 | return false; |
338 | 338 | } |
339 | 339 | |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | */ |
358 | 358 | public function isEditable(Model $model) |
359 | 359 | { |
360 | - if (! is_callable($this->getEdit())) { |
|
360 | + if (!is_callable($this->getEdit())) { |
|
361 | 361 | return false; |
362 | 362 | } |
363 | 363 | |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | */ |
468 | 468 | public function fireDisplay() |
469 | 469 | { |
470 | - if (! is_callable($this->display)) { |
|
470 | + if (!is_callable($this->display)) { |
|
471 | 471 | return; |
472 | 472 | } |
473 | 473 | |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | */ |
486 | 486 | public function fireCreate() |
487 | 487 | { |
488 | - if (! is_callable($this->create)) { |
|
488 | + if (!is_callable($this->create)) { |
|
489 | 489 | return; |
490 | 490 | } |
491 | 491 | |
@@ -512,11 +512,11 @@ discard block |
||
512 | 512 | */ |
513 | 513 | public function fireEdit($id) |
514 | 514 | { |
515 | - if (! is_callable($this->edit)) { |
|
515 | + if (!is_callable($this->edit)) { |
|
516 | 516 | return; |
517 | 517 | } |
518 | 518 | |
519 | - $form = app()->call($this->edit, ['id' => $id]); |
|
519 | + $form = app()->call($this->edit, [ 'id' => $id ]); |
|
520 | 520 | if ($form instanceof DisplayInterface) { |
521 | 521 | $form->setModelClass($this->getClass()); |
522 | 522 | } |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | public function fireDelete($id) |
542 | 542 | { |
543 | 543 | if (is_callable($this->getDelete())) { |
544 | - return app()->call($this->getDelete(), [$id]); |
|
544 | + return app()->call($this->getDelete(), [ $id ]); |
|
545 | 545 | } |
546 | 546 | } |
547 | 547 | |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | public function fireDestroy($id) |
554 | 554 | { |
555 | 555 | if (is_callable($this->getDestroy())) { |
556 | - return app()->call($this->getDestroy(), [$id]); |
|
556 | + return app()->call($this->getDestroy(), [ $id ]); |
|
557 | 557 | } |
558 | 558 | } |
559 | 559 | |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | public function fireRestore($id) |
566 | 566 | { |
567 | 567 | if (is_callable($this->getRestore())) { |
568 | - return app()->call($this->getRestore(), [$id]); |
|
568 | + return app()->call($this->getRestore(), [ $id ]); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | return $this->getRestore(); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | /** |
56 | 56 | * @var array |
57 | 57 | */ |
58 | - protected $validationMessages = []; |
|
58 | + protected $validationMessages = [ ]; |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * @param string $path |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | { |
85 | 85 | $name = array_shift($parts); |
86 | 86 | |
87 | - while (! empty($parts)) { |
|
87 | + while (!empty($parts)) { |
|
88 | 88 | $part = array_shift($parts); |
89 | 89 | $name .= "[$part]"; |
90 | 90 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | $messages = parent::getValidationMessages(); |
286 | 286 | |
287 | 287 | foreach ($this->validationMessages as $rule => $message) { |
288 | - $messages[$this->getName().'.'.$rule] = $message; |
|
288 | + $messages[ $this->getName().'.'.$rule ] = $message; |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | return $messages; |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | $rule = substr($rule, 0, $pos); |
316 | 316 | } |
317 | 317 | |
318 | - $this->validationMessages[$rule] = $message; |
|
318 | + $this->validationMessages[ $rule ] = $message; |
|
319 | 319 | |
320 | 320 | return $this; |
321 | 321 | } |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | */ |
326 | 326 | public function getValidationLabels() |
327 | 327 | { |
328 | - return [$this->getPath() => $this->getLabel()]; |
|
328 | + return [ $this->getPath() => $this->getLabel() ]; |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | */ |
334 | 334 | public function getValueFromRequest() |
335 | 335 | { |
336 | - if (! is_null($value = Request::old($this->getPath()))) { |
|
336 | + if (!is_null($value = Request::old($this->getPath()))) { |
|
337 | 337 | return $value; |
338 | 338 | } |
339 | 339 | |
@@ -346,14 +346,14 @@ discard block |
||
346 | 346 | */ |
347 | 347 | public function getValue() |
348 | 348 | { |
349 | - if (! is_null($value = $this->getValueFromRequest())) { |
|
349 | + if (!is_null($value = $this->getValueFromRequest())) { |
|
350 | 350 | return $value; |
351 | 351 | } |
352 | 352 | |
353 | 353 | $model = $this->getModel(); |
354 | 354 | $value = $this->getDefaultValue(); |
355 | 355 | |
356 | - if (is_null($model) or ! $model->exists) { |
|
356 | + if (is_null($model) or !$model->exists) { |
|
357 | 357 | return $value; |
358 | 358 | } |
359 | 359 | |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | } |
406 | 406 | unset($rule); |
407 | 407 | |
408 | - return [$this->getPath() => $rules]; |
|
408 | + return [ $this->getPath() => $rules ]; |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | /** |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * @var array |
25 | 25 | */ |
26 | - protected $options = []; |
|
26 | + protected $options = [ ]; |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * @var bool |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | /** |
44 | 44 | * @var array |
45 | 45 | */ |
46 | - protected $exclude = []; |
|
46 | + protected $exclude = [ ]; |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * @var string|null |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | /** |
54 | 54 | * @var array |
55 | 55 | */ |
56 | - protected $fetchColumns = []; |
|
56 | + protected $fetchColumns = [ ]; |
|
57 | 57 | |
58 | 58 | /** |
59 | 59 | * @var function|\Closure|object callable |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @param string|null $label |
66 | 66 | * @param array|Model $options |
67 | 67 | */ |
68 | - public function __construct($path, $label = null, $options = []) |
|
68 | + public function __construct($path, $label = null, $options = [ ]) |
|
69 | 69 | { |
70 | 70 | parent::__construct($path, $label); |
71 | 71 | |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $modelForOptions = app($modelForOptions); |
97 | 97 | } |
98 | 98 | |
99 | - if (! ($modelForOptions instanceof Model)) { |
|
99 | + if (!($modelForOptions instanceof Model)) { |
|
100 | 100 | throw new SelectException('Class must be instanced of Illuminate\Database\Eloquent\Model'); |
101 | 101 | } |
102 | 102 | |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function getOptions() |
132 | 132 | { |
133 | - if (! is_null($this->getModelForOptions()) && ! is_null($this->getDisplay())) { |
|
133 | + if (!is_null($this->getModelForOptions()) && !is_null($this->getDisplay())) { |
|
134 | 134 | $this->loadOptions(); |
135 | 135 | } |
136 | 136 | |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | */ |
238 | 238 | public function setFetchColumns($columns) |
239 | 239 | { |
240 | - if (! is_array($columns)) { |
|
240 | + if (!is_array($columns)) { |
|
241 | 241 | $columns = func_get_args(); |
242 | 242 | } |
243 | 243 | |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | */ |
299 | 299 | public function exclude($keys) |
300 | 300 | { |
301 | - if (! is_array($keys)) { |
|
301 | + if (!is_array($keys)) { |
|
302 | 302 | $keys = func_get_args(); |
303 | 303 | } |
304 | 304 | |
@@ -344,17 +344,17 @@ discard block |
||
344 | 344 | ]; |
345 | 345 | |
346 | 346 | if ($this->isReadonly()) { |
347 | - $attributes['disabled'] = 'disabled'; |
|
347 | + $attributes[ 'disabled' ] = 'disabled'; |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | if ($this->isNullable()) { |
351 | - $attributes['data-nullable'] = 'true'; |
|
351 | + $attributes[ 'data-nullable' ] = 'true'; |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | $options = $this->getOptions(); |
355 | 355 | |
356 | 356 | if ($this->isNullable()) { |
357 | - $options = [null => trans('sleeping_owl::lang.select.nothing')] + $options; |
|
357 | + $options = [ null => trans('sleeping_owl::lang.select.nothing') ] + $options; |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | $options = array_except($options, $this->exclude); |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | */ |
372 | 372 | protected function loadOptions() |
373 | 373 | { |
374 | - $repository = app(RepositoryInterface::class, [$this->getModelForOptions()]); |
|
374 | + $repository = app(RepositoryInterface::class, [ $this->getModelForOptions() ]); |
|
375 | 375 | |
376 | 376 | $key = $repository->getModel()->getKeyName(); |
377 | 377 | |
@@ -382,12 +382,12 @@ discard block |
||
382 | 382 | } |
383 | 383 | |
384 | 384 | if (count($this->fetchColumns) > 0) { |
385 | - $columns = array_merge([$key], $this->fetchColumns); |
|
385 | + $columns = array_merge([ $key ], $this->fetchColumns); |
|
386 | 386 | $options->select($columns); |
387 | 387 | } |
388 | 388 | |
389 | 389 | // call the pre load options query preparer if has be set |
390 | - if (! is_null($preparer = $this->getLoadOptionsQueryPreparer())) { |
|
390 | + if (!is_null($preparer = $this->getLoadOptionsQueryPreparer())) { |
|
391 | 391 | $options = $preparer($this, $options); |
392 | 392 | } |
393 | 393 | |
@@ -404,9 +404,9 @@ discard block |
||
404 | 404 | |
405 | 405 | // iterate for all options and redefine it as |
406 | 406 | // list of KEY and TEXT pair |
407 | - $options = array_map(function ($opt) use ($key, $makeDisplay) { |
|
407 | + $options = array_map(function($opt) use ($key, $makeDisplay) { |
|
408 | 408 | // get the KEY and make the display text |
409 | - return [data_get($opt, $key), $makeDisplay($opt)]; |
|
409 | + return [ data_get($opt, $key), $makeDisplay($opt) ]; |
|
410 | 410 | }, $options); |
411 | 411 | |
412 | 412 | // take options as array with KEY => VALUE pair |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $value = null; |
54 | 54 | } |
55 | 55 | |
56 | - if (! is_null($value)) { |
|
56 | + if (!is_null($value)) { |
|
57 | 57 | try { |
58 | 58 | $time = Carbon::parse($value); |
59 | 59 | } catch (Exception $e) { |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function setValue(Model $model, $attribute, $value) |
95 | 95 | { |
96 | - $value = ! empty($value) ? Carbon::createFromFormat($this->getFormat(), $value) : null; |
|
96 | + $value = !empty($value) ? Carbon::createFromFormat($this->getFormat(), $value) : null; |
|
97 | 97 | |
98 | 98 | parent::setValue($model, $attribute, $value); |
99 | 99 | } |
@@ -91,11 +91,11 @@ discard block |
||
91 | 91 | ]; |
92 | 92 | |
93 | 93 | if ($this->isReadonly()) { |
94 | - $attributes['disabled'] = 'disabled'; |
|
94 | + $attributes[ 'disabled' ] = 'disabled'; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | if ($this->isTaggable()) { |
98 | - $attributes['class'] .= ' input-taggable'; |
|
98 | + $attributes[ 'class' ] .= ' input-taggable'; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | return [ |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $attribute = $this->getAttribute(); |
121 | 121 | |
122 | 122 | if (is_null(Request::input($this->getPath()))) { |
123 | - $values = []; |
|
123 | + $values = [ ]; |
|
124 | 124 | } else { |
125 | 125 | $values = $this->getValue(); |
126 | 126 | } |
@@ -129,19 +129,19 @@ discard block |
||
129 | 129 | |
130 | 130 | if ($relation instanceof \Illuminate\Database\Eloquent\Relations\BelongsToMany) { |
131 | 131 | foreach ($values as $i => $value) { |
132 | - if (! array_key_exists($value, $this->getOptions()) and $this->isTaggable()) { |
|
132 | + if (!array_key_exists($value, $this->getOptions()) and $this->isTaggable()) { |
|
133 | 133 | $model = clone $this->getModelForOptions(); |
134 | 134 | $model->{$this->getDisplay()} = $value; |
135 | 135 | $model->save(); |
136 | 136 | |
137 | - $values[$i] = $model->getKey(); |
|
137 | + $values[ $i ] = $model->getKey(); |
|
138 | 138 | } |
139 | 139 | } |
140 | 140 | |
141 | 141 | $relation->sync($values); |
142 | 142 | } elseif ($relation instanceof \Illuminate\Database\Eloquent\Relations\HasMany) { |
143 | 143 | foreach ($relation->get() as $item) { |
144 | - if (! in_array($item->getKey(), $values)) { |
|
144 | + if (!in_array($item->getKey(), $values)) { |
|
145 | 145 | if ($this->isDeleteRelatedItem()) { |
146 | 146 | $item->delete(); |
147 | 147 | } else { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $item = $model->find($value); |
158 | 158 | |
159 | 159 | if (is_null($item)) { |
160 | - if (! $this->isTaggable()) { |
|
160 | + if (!$this->isTaggable()) { |
|
161 | 161 | continue; |
162 | 162 | } |
163 | 163 |
@@ -17,13 +17,13 @@ discard block |
||
17 | 17 | */ |
18 | 18 | protected static function validate(Validator $validator) |
19 | 19 | { |
20 | - $validator->after(function ($validator) { |
|
20 | + $validator->after(function($validator) { |
|
21 | 21 | /** @var \Illuminate\Http\UploadedFile $file */ |
22 | 22 | $file = array_get($validator->attributes(), 'file'); |
23 | 23 | |
24 | 24 | $size = getimagesize($file->getRealPath()); |
25 | 25 | |
26 | - if (! $size) { |
|
26 | + if (!$size) { |
|
27 | 27 | $validator->errors()->add('file', trans('sleeping_owl::validation.not_image')); |
28 | 28 | } |
29 | 29 | }); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $image = \Intervention\Image\Facades\Image::make($file); |
46 | 46 | |
47 | 47 | foreach ($settings as $method => $args) { |
48 | - call_user_func_array([$image, $method], $args); |
|
48 | + call_user_func_array([ $image, $method ], $args); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | return $image->save($path.'/'.$filename); |
@@ -77,5 +77,5 @@ discard block |
||
77 | 77 | /** |
78 | 78 | * @var array |
79 | 79 | */ |
80 | - protected $uploadValidationRules = ['required', 'image']; |
|
80 | + protected $uploadValidationRules = [ 'required', 'image' ]; |
|
81 | 81 | } |
@@ -313,11 +313,11 @@ discard block |
||
313 | 313 | */ |
314 | 314 | public function isShowDeleteButton() |
315 | 315 | { |
316 | - if (is_null($this->getModel()->getKey()) || ! $this->showDeleteButton) { |
|
316 | + if (is_null($this->getModel()->getKey()) || !$this->showDeleteButton) { |
|
317 | 317 | return false; |
318 | 318 | } |
319 | 319 | |
320 | - $this->showDeleteButton = ! $this->isTrashed() && $this->getModelConfiguration()->isDeletable($this->getModel()); |
|
320 | + $this->showDeleteButton = !$this->isTrashed() && $this->getModelConfiguration()->isDeletable($this->getModel()); |
|
321 | 321 | |
322 | 322 | return $this->showDeleteButton; |
323 | 323 | } |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | */ |
338 | 338 | public function isShowDestroyButton() |
339 | 339 | { |
340 | - if (is_null($this->getModel()->getKey()) || ! $this->showDestroyButton) { |
|
340 | + if (is_null($this->getModel()->getKey()) || !$this->showDestroyButton) { |
|
341 | 341 | return false; |
342 | 342 | } |
343 | 343 | |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | */ |
363 | 363 | public function isShowRestoreButton() |
364 | 364 | { |
365 | - if (is_null($this->getModel()->getKey()) || ! $this->showRestoreButton) { |
|
365 | + if (is_null($this->getModel()->getKey()) || !$this->showRestoreButton) { |
|
366 | 366 | return false; |
367 | 367 | } |
368 | 368 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param array $elements |
23 | 23 | */ |
24 | - public function __construct(array $elements = []) |
|
24 | + public function __construct(array $elements = [ ]) |
|
25 | 25 | { |
26 | 26 | $this->elements = new Collection(); |
27 | 27 | parent::__construct($elements); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $element = new Column($element); |
68 | 68 | } |
69 | 69 | |
70 | - if (! ($element instanceof ColumnInterface)) { |
|
70 | + if (!($element instanceof ColumnInterface)) { |
|
71 | 71 | throw new \Exception('Column should be instance of ColumnInterface'); |
72 | 72 | } |
73 | 73 | |
@@ -82,16 +82,16 @@ discard block |
||
82 | 82 | { |
83 | 83 | $this->setHtmlAttribute('class', 'row'); |
84 | 84 | |
85 | - $count = $this->getElements()->filter(function (ColumnInterface $column) { |
|
85 | + $count = $this->getElements()->filter(function(ColumnInterface $column) { |
|
86 | 86 | return $column->getWidth() === 0; |
87 | 87 | })->count(); |
88 | 88 | |
89 | - $width = $this->maxWidth - $this->getElements()->sum(function (ColumnInterface $column) { |
|
89 | + $width = $this->maxWidth - $this->getElements()->sum(function(ColumnInterface $column) { |
|
90 | 90 | return $column->getWidth(); |
91 | 91 | }); |
92 | 92 | |
93 | - $this->getElements()->each(function (ColumnInterface $column) use ($width, $count) { |
|
94 | - if (! $column->getWidth()) { |
|
93 | + $this->getElements()->each(function(ColumnInterface $column) use ($width, $count) { |
|
94 | + if (!$column->getWidth()) { |
|
95 | 95 | $column->setWidth(floor($width / $count)); |
96 | 96 | } |
97 | 97 | }); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function setSize($size) |
133 | 133 | { |
134 | - $this->getColumns()->each(function (ColumnInterface $column) use ($size) { |
|
134 | + $this->getColumns()->each(function(ColumnInterface $column) use ($size) { |
|
135 | 135 | $column->setSize($size); |
136 | 136 | }); |
137 | 137 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | * |
15 | 15 | * @param array $elements |
16 | 16 | */ |
17 | - public function __construct(array $elements = []) |
|
17 | + public function __construct(array $elements = [ ]) |
|
18 | 18 | { |
19 | 19 | parent::__construct(); |
20 | 20 |