@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | parent::initialize(); |
| 29 | 29 | |
| 30 | - $this->applyCallbackToItems(function ($item) { |
|
| 30 | + $this->applyCallbackToItems(function($item) { |
|
| 31 | 31 | if ($item instanceof Initializable) { |
| 32 | 32 | $item->initialize(); |
| 33 | 33 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | parent::setModel($model); |
| 67 | 67 | |
| 68 | - $this->applyCallbackToItems(function ($item) use ($model) { |
|
| 68 | + $this->applyCallbackToItems(function($item) use ($model) { |
|
| 69 | 69 | if ($item instanceof FormElementInterface) { |
| 70 | 70 | $item->setModel($model); |
| 71 | 71 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function getValidationMessages() |
| 113 | 113 | { |
| 114 | - $messages = []; |
|
| 114 | + $messages = [ ]; |
|
| 115 | 115 | |
| 116 | 116 | foreach ($this->getColumns() as $columnItems) { |
| 117 | 117 | foreach ($columnItems as $item) { |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function getValidationLabels() |
| 131 | 131 | { |
| 132 | - $labels = []; |
|
| 132 | + $labels = [ ]; |
|
| 133 | 133 | |
| 134 | 134 | foreach ($this->getColumns() as $columnItems) { |
| 135 | 135 | foreach ($columnItems as $item) { |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | { |
| 147 | 147 | parent::save(); |
| 148 | 148 | |
| 149 | - $this->applyCallbackToItems(function ($item) { |
|
| 149 | + $this->applyCallbackToItems(function($item) { |
|
| 150 | 150 | if ($item instanceof FormElementInterface) { |
| 151 | 151 | $item->save(); |
| 152 | 152 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | { |
| 158 | 158 | parent::afterSave(); |
| 159 | 159 | |
| 160 | - $this->applyCallbackToItems(function ($item) { |
|
| 160 | + $this->applyCallbackToItems(function($item) { |
|
| 161 | 161 | if ($item instanceof FormElementInterface) { |
| 162 | 162 | $item->afterSave(); |
| 163 | 163 | } |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | ]; |
| 92 | 92 | |
| 93 | 93 | if ($this->isTaggable()) { |
| 94 | - $attributes['class'] .= ' input-taggable'; |
|
| 94 | + $attributes[ 'class' ] .= ' input-taggable'; |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | return [ |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | $attribute = $this->getAttribute(); |
| 117 | 117 | |
| 118 | 118 | if (is_null(Request::input($this->getPath()))) { |
| 119 | - $values = []; |
|
| 119 | + $values = [ ]; |
|
| 120 | 120 | } else { |
| 121 | 121 | $values = $this->getValue(); |
| 122 | 122 | } |
@@ -125,19 +125,19 @@ discard block |
||
| 125 | 125 | |
| 126 | 126 | if ($relation instanceof \Illuminate\Database\Eloquent\Relations\BelongsToMany) { |
| 127 | 127 | foreach ($values as $i => $value) { |
| 128 | - if (! array_key_exists($value, $this->getOptions()) and $this->isTaggable()) { |
|
| 128 | + if (!array_key_exists($value, $this->getOptions()) and $this->isTaggable()) { |
|
| 129 | 129 | $model = clone $this->getModelForOptions(); |
| 130 | 130 | $model->{$this->getDisplay()} = $value; |
| 131 | 131 | $model->save(); |
| 132 | 132 | |
| 133 | - $values[$i] = $model->getKey(); |
|
| 133 | + $values[ $i ] = $model->getKey(); |
|
| 134 | 134 | } |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | $relation->sync($values); |
| 138 | 138 | } elseif ($relation instanceof \Illuminate\Database\Eloquent\Relations\HasMany) { |
| 139 | 139 | foreach ($relation->get() as $item) { |
| 140 | - if (! in_array($item->getKey(), $values)) { |
|
| 140 | + if (!in_array($item->getKey(), $values)) { |
|
| 141 | 141 | if ($this->isDeleteRelatedItem()) { |
| 142 | 142 | $item->delete(); |
| 143 | 143 | } else { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $item = $model->find($value); |
| 154 | 154 | |
| 155 | 155 | if (is_null($item)) { |
| 156 | - if (! $this->isTaggable()) { |
|
| 156 | + if (!$this->isTaggable()) { |
|
| 157 | 157 | continue; |
| 158 | 158 | } |
| 159 | 159 | |
@@ -18,8 +18,8 @@ discard block |
||
| 18 | 18 | public static function registerRoutes() |
| 19 | 19 | { |
| 20 | 20 | $routeName = 'admin.form.element.file.'.static::$route; |
| 21 | - if (! Route::has($routeName)) { |
|
| 22 | - Route::post('FormElements/image/'.static::$route, ['as' => $routeName, function () { |
|
| 21 | + if (!Route::has($routeName)) { |
|
| 22 | + Route::post('FormElements/image/'.static::$route, [ 'as' => $routeName, function() { |
|
| 23 | 23 | $validator = Validator::make(Request::all(), static::uploadValidationRules()); |
| 24 | 24 | |
| 25 | 25 | static::uploadValidationRules($validator); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | 'url' => asset($value), |
| 41 | 41 | 'value' => $value, |
| 42 | 42 | ]; |
| 43 | - }]); |
|
| 43 | + } ]); |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | |
@@ -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 | |