@@ -9,8 +9,8 @@ |
||
| 9 | 9 | public function save() |
| 10 | 10 | { |
| 11 | 11 | $name = $this->getName(); |
| 12 | - if (! Request::has($name)) { |
|
| 13 | - Request::merge([$name => 0]); |
|
| 12 | + if (!Request::has($name)) { |
|
| 13 | + Request::merge([ $name => 0 ]); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | parent::save(); |
@@ -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 | } |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | $messages = parent::getValidationMessages(); |
| 290 | 290 | |
| 291 | 291 | foreach ($this->validationMessages as $rule => $message) { |
| 292 | - $messages[$this->getName().'.'.$rule] = $message; |
|
| 292 | + $messages[ $this->getName().'.'.$rule ] = $message; |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | return $messages; |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | */ |
| 316 | 316 | public function addValidationMessage($rule, $message) |
| 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 | /** |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | */ |
| 335 | 335 | public function getValue() |
| 336 | 336 | { |
| 337 | - if (! is_null($value = Request::old($this->getPath()))) { |
|
| 337 | + if (!is_null($value = Request::old($this->getPath()))) { |
|
| 338 | 338 | return $value; |
| 339 | 339 | } |
| 340 | 340 | |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | $model = $this->getModel(); |
| 349 | 349 | $value = $this->getDefaultValue(); |
| 350 | 350 | |
| 351 | - if (is_null($model) or ! $model->exists) { |
|
| 351 | + if (is_null($model) or !$model->exists) { |
|
| 352 | 352 | return $value; |
| 353 | 353 | } |
| 354 | 354 | |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | } |
| 402 | 402 | unset($rule); |
| 403 | 403 | |
| 404 | - return [$this->getPath() => $rules]; |
|
| 404 | + return [ $this->getPath() => $rules ]; |
|
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | /** |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | { |
| 14 | 14 | $value = $this->getValue(); |
| 15 | 15 | |
| 16 | - if (! $this->isAllowedEmptyValue() and $this->getModel()->exists() and empty($value)) { |
|
| 16 | + if (!$this->isAllowedEmptyValue() and $this->getModel()->exists() and empty($value)) { |
|
| 17 | 17 | return; |
| 18 | 18 | } |
| 19 | 19 | |
@@ -27,11 +27,11 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | $data = parent::getValidationRules(); |
| 29 | 29 | |
| 30 | - if (! $this->isAllowedEmptyValue() and $this->getModel()->exists()) { |
|
| 30 | + if (!$this->isAllowedEmptyValue() and $this->getModel()->exists()) { |
|
| 31 | 31 | foreach ($data as $field => $rules) { |
| 32 | 32 | foreach ($rules as $i => $rule) { |
| 33 | 33 | if ($rule == 'required') { |
| 34 | - unset($data[$field][$i]); |
|
| 34 | + unset($data[ $field ][ $i ]); |
|
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | } |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | /** |
| 20 | 20 | * @var array |
| 21 | 21 | */ |
| 22 | - protected $parameters = []; |
|
| 22 | + protected $parameters = [ ]; |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * @var bool |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | */ |
| 89 | 89 | public function setHeight($height) |
| 90 | 90 | { |
| 91 | - $this->parameters['height'] = (int) $height; |
|
| 91 | + $this->parameters[ 'height' ] = (int) $height; |
|
| 92 | 92 | |
| 93 | 93 | return $this; |
| 94 | 94 | } |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | $filteredValue = $value; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - if (! empty($this->filteredFieldKey)) { |
|
| 155 | + if (!empty($this->filteredFieldKey)) { |
|
| 156 | 156 | parent::setValue($model, $attribute, $value); |
| 157 | 157 | parent::setValue($model, $this->filteredFieldKey, $filteredValue); |
| 158 | 158 | } else { |
@@ -24,7 +24,7 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | public function __construct(Closure $callback = null) |
| 26 | 26 | { |
| 27 | - if (! is_null($callback)) { |
|
| 27 | + if (!is_null($callback)) { |
|
| 28 | 28 | $this->setCallback($callback); |
| 29 | 29 | } |
| 30 | 30 | |
@@ -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 | - if (! is_null($value)) { |
|
| 96 | + if (!is_null($value)) { |
|
| 97 | 97 | $value = Carbon::createFromFormat($this->getFormat(), $value); |
| 98 | 98 | } |
| 99 | 99 | |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | - * @return $this|NamedFormElement|mixed|null|string |
|
| 46 | + * @return null|string |
|
| 47 | 47 | */ |
| 48 | 48 | public function getValue() |
| 49 | 49 | { |
@@ -14,13 +14,13 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | protected static function validate(\Illuminate\Validation\Validator $validator) |
| 16 | 16 | { |
| 17 | - $validator->after(function ($validator) { |
|
| 17 | + $validator->after(function($validator) { |
|
| 18 | 18 | /** @var \Illuminate\Http\UploadedFile $file */ |
| 19 | 19 | $file = array_get($validator->attributes(), 'file'); |
| 20 | 20 | |
| 21 | 21 | $size = getimagesize($file->getRealPath()); |
| 22 | 22 | |
| 23 | - if (! $size) { |
|
| 23 | + if (!$size) { |
|
| 24 | 24 | $validator->errors()->add('file', trans('sleeping_owl::validation.not_image')); |
| 25 | 25 | } |
| 26 | 26 | }); |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | |
| 32 | 32 | if (Request::input($this->getPath().'_remove')) { |
| 33 | 33 | $this->setValue($this->getModel(), $this->getAttribute(), null); |
| 34 | - } elseif (! is_null($value)) { |
|
| 34 | + } elseif (!is_null($value)) { |
|
| 35 | 35 | $this->setValue($this->getModel(), $this->getAttribute(), $value); |
| 36 | 36 | } |
| 37 | 37 | } |
@@ -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,13 +344,13 @@ discard block |
||
| 344 | 344 | ]; |
| 345 | 345 | |
| 346 | 346 | if ($this->isNullable()) { |
| 347 | - $attributes['data-nullable'] = 'true'; |
|
| 347 | + $attributes[ 'data-nullable' ] = 'true'; |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | $options = $this->getOptions(); |
| 351 | 351 | |
| 352 | 352 | if ($this->isNullable()) { |
| 353 | - $options = [null => trans('sleeping_owl::lang.select.nothing')] + $options; |
|
| 353 | + $options = [ null => trans('sleeping_owl::lang.select.nothing') ] + $options; |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | $options = array_except($options, $this->exclude); |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | */ |
| 368 | 368 | protected function loadOptions() |
| 369 | 369 | { |
| 370 | - $repository = app(RepositoryInterface::class, [$this->getModelForOptions()]); |
|
| 370 | + $repository = app(RepositoryInterface::class, [ $this->getModelForOptions() ]); |
|
| 371 | 371 | |
| 372 | 372 | $key = $repository->getModel()->getKeyName(); |
| 373 | 373 | |
@@ -378,12 +378,12 @@ discard block |
||
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | if (count($this->fetchColumns) > 0) { |
| 381 | - $columns = array_merge([$key], $this->fetchColumns); |
|
| 381 | + $columns = array_merge([ $key ], $this->fetchColumns); |
|
| 382 | 382 | $options->select($columns); |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | // call the pre load options query preparer if has be set |
| 386 | - if (! is_null($preparer = $this->getLoadOptionsQueryPreparer())) { |
|
| 386 | + if (!is_null($preparer = $this->getLoadOptionsQueryPreparer())) { |
|
| 387 | 387 | $options = $preparer($this, $options); |
| 388 | 388 | } |
| 389 | 389 | |
@@ -400,9 +400,9 @@ discard block |
||
| 400 | 400 | |
| 401 | 401 | // iterate for all options and redefine it as |
| 402 | 402 | // list of KEY and TEXT pair |
| 403 | - $options = array_map(function ($opt) use ($key, $makeDisplay) { |
|
| 403 | + $options = array_map(function($opt) use ($key, $makeDisplay) { |
|
| 404 | 404 | // get the KEY and make the display text |
| 405 | - return [data_get($opt, $key), $makeDisplay($opt)]; |
|
| 405 | + return [ data_get($opt, $key), $makeDisplay($opt) ]; |
|
| 406 | 406 | }, $options); |
| 407 | 407 | |
| 408 | 408 | // take options as array with KEY => VALUE pair |