@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | { |
| 44 | 44 | $this->initializeElements(); |
| 45 | 45 | |
| 46 | - $activeTabs = $this->getTabs()->filter(function (TabInterface $tab) { |
|
| 46 | + $activeTabs = $this->getTabs()->filter(function(TabInterface $tab) { |
|
| 47 | 47 | return $tab->isActive(); |
| 48 | 48 | })->count(); |
| 49 | 49 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function setModelClass($class) |
| 59 | 59 | { |
| 60 | - $this->getTabs()->each(function (TabInterface $tab) use ($class) { |
|
| 60 | + $this->getTabs()->each(function(TabInterface $tab) use ($class) { |
|
| 61 | 61 | if ($tab instanceof DisplayInterface) { |
| 62 | 62 | $tab->setModelClass($class); |
| 63 | 63 | } |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | public function setAction($action) |
| 139 | 139 | { |
| 140 | - $this->getTabs()->each(function (TabInterface $tab) use ($action) { |
|
| 140 | + $this->getTabs()->each(function(TabInterface $tab) use ($action) { |
|
| 141 | 141 | if ($tab instanceof FormInterface) { |
| 142 | 142 | $tab->setAction($action); |
| 143 | 143 | } |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | */ |
| 150 | 150 | public function setId($id) |
| 151 | 151 | { |
| 152 | - $this->getTabs()->each(function (TabInterface $tab) use ($id) { |
|
| 152 | + $this->getTabs()->each(function(TabInterface $tab) use ($id) { |
|
| 153 | 153 | if ($tab instanceof FormInterface) { |
| 154 | 154 | $tab->setId($id); |
| 155 | 155 | } |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | foreach ($this->getTabs() as $tab) { |
| 167 | 167 | if ($tab instanceof FormInterface) { |
| 168 | 168 | $result = $tab->validateForm($model); |
| 169 | - if (! is_null($result)) { |
|
| 169 | + if (!is_null($result)) { |
|
| 170 | 170 | return $result; |
| 171 | 171 | } |
| 172 | 172 | } |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | */ |
| 179 | 179 | public function saveForm(ModelConfigurationInterface $model) |
| 180 | 180 | { |
| 181 | - $this->getTabs()->each(function (TabInterface $tab) use ($model) { |
|
| 181 | + $this->getTabs()->each(function(TabInterface $tab) use ($model) { |
|
| 182 | 182 | if ($tab instanceof FormInterface) { |
| 183 | 183 | $tab->saveForm($model); |
| 184 | 184 | } |
@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | public function fireDisplay() |
| 34 | 34 | { |
| 35 | - if (! method_exists($this, 'onDisplay')) { |
|
| 35 | + if (!method_exists($this, 'onDisplay')) { |
|
| 36 | 36 | return; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - $display = app()->call([$this, 'onDisplay']); |
|
| 39 | + $display = app()->call([ $this, 'onDisplay' ]); |
|
| 40 | 40 | |
| 41 | 41 | if ($display instanceof DisplayInterface) { |
| 42 | 42 | $display->setModelClass($this->getClass()); |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | public function fireCreate() |
| 53 | 53 | { |
| 54 | - if (! method_exists($this, 'onCreate')) { |
|
| 54 | + if (!method_exists($this, 'onCreate')) { |
|
| 55 | 55 | return; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - $form = app()->call([$this, 'onCreate']); |
|
| 58 | + $form = app()->call([ $this, 'onCreate' ]); |
|
| 59 | 59 | if ($form instanceof DisplayInterface) { |
| 60 | 60 | $form->setModelClass($this->getClass()); |
| 61 | 61 | } |
@@ -78,11 +78,11 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function fireEdit($id) |
| 80 | 80 | { |
| 81 | - if (! method_exists($this, 'onEdit')) { |
|
| 81 | + if (!method_exists($this, 'onEdit')) { |
|
| 82 | 82 | return; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - $form = app()->call([$this, 'onEdit'], ['id' => $id]); |
|
| 85 | + $form = app()->call([ $this, 'onEdit' ], [ 'id' => $id ]); |
|
| 86 | 86 | if ($form instanceof DisplayInterface) { |
| 87 | 87 | $form->setModelClass($this->getClass()); |
| 88 | 88 | } |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | public function fireDelete($id) |
| 108 | 108 | { |
| 109 | 109 | if (method_exists($this, 'onDelete')) { |
| 110 | - return app()->call([$this, 'onDelete'], ['id' => $id]); |
|
| 110 | + return app()->call([ $this, 'onDelete' ], [ 'id' => $id ]); |
|
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | public function fireDestroy($id) |
| 120 | 120 | { |
| 121 | 121 | if (method_exists($this, 'onDestroy')) { |
| 122 | - return app()->call([$this, 'onDestroy'], ['id' => $id]); |
|
| 122 | + return app()->call([ $this, 'onDestroy' ], [ 'id' => $id ]); |
|
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | public function fireRestore($id) |
| 132 | 132 | { |
| 133 | 133 | if (method_exists($this, 'onRestore')) { |
| 134 | - return app()->call([$this, 'onRestore'], ['id' => $id]); |
|
| 134 | + return app()->call([ $this, 'onRestore' ], [ 'id' => $id ]); |
|
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | } |
@@ -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 | /** |
@@ -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 | } |
@@ -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 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | * |
| 74 | 74 | * @param array $elements |
| 75 | 75 | */ |
| 76 | - public function __construct(array $elements = []) |
|
| 76 | + public function __construct(array $elements = [ ]) |
|
| 77 | 77 | { |
| 78 | 78 | parent::__construct($elements); |
| 79 | 79 | |
@@ -94,14 +94,14 @@ discard block |
||
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | $this->initialized = true; |
| 97 | - $this->repository = app(RepositoryInterface::class, [$this->class]); |
|
| 97 | + $this->repository = app(RepositoryInterface::class, [ $this->class ]); |
|
| 98 | 98 | |
| 99 | 99 | $this->setModel(app($this->class)); |
| 100 | 100 | |
| 101 | 101 | parent::initialize(); |
| 102 | 102 | |
| 103 | - $this->getElements()->each(function ($element) { |
|
| 104 | - if ($element instanceof Upload and ! $this->hasHtmlAttribute('enctype')) { |
|
| 103 | + $this->getElements()->each(function($element) { |
|
| 104 | + if ($element instanceof Upload and !$this->hasHtmlAttribute('enctype')) { |
|
| 105 | 105 | $this->setHtmlAttribute('enctype', 'multipart/form-data'); |
| 106 | 106 | } |
| 107 | 107 | }); |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | */ |
| 231 | 231 | public function setItems($items) |
| 232 | 232 | { |
| 233 | - if (! is_array($items)) { |
|
| 233 | + if (!is_array($items)) { |
|
| 234 | 234 | $items = func_get_args(); |
| 235 | 235 | } |
| 236 | 236 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | public function setId($id) |
| 259 | 259 | { |
| 260 | - if (is_null($this->id) and ! is_null($id) and ($model = $this->getRepository()->find($id))) { |
|
| 260 | + if (is_null($this->id) and !is_null($id) and ($model = $this->getRepository()->find($id))) { |
|
| 261 | 261 | $this->id = $id; |
| 262 | 262 | $this->setModel($model); |
| 263 | 263 | } |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | $model = $this->getModel(); |
| 324 | 324 | |
| 325 | 325 | foreach ($model->getRelations() as $name => $relation) { |
| 326 | - if ($model->{$name}() instanceof BelongsTo && ! is_null($relation)) { |
|
| 326 | + if ($model->{$name}() instanceof BelongsTo && !is_null($relation)) { |
|
| 327 | 327 | $relation->save(); |
| 328 | 328 | $model->{$name}()->associate($relation); |
| 329 | 329 | } |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | $model = $this->getModel(); |
| 336 | 336 | |
| 337 | 337 | foreach ($model->getRelations() as $name => $relation) { |
| 338 | - if ($model->{$name}() instanceof HasOneOrMany && ! is_null($relation)) { |
|
| 338 | + if ($model->{$name}() instanceof HasOneOrMany && !is_null($relation)) { |
|
| 339 | 339 | if (is_array($relation) || $relation instanceof \Traversable) { |
| 340 | 340 | $model->{$name}()->saveMany($relation); |
| 341 | 341 | } else { |
@@ -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 | } |