@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | public function storeAsJson() |
| 14 | 14 | { |
| 15 | - $this->mutateValue(function ($value) { |
|
| 15 | + $this->mutateValue(function($value) { |
|
| 16 | 16 | return json_encode($value); |
| 17 | 17 | }); |
| 18 | 18 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | public function storeAsComaSeparatedValue() |
| 28 | 28 | { |
| 29 | - $this->mutateValue(function ($value) { |
|
| 29 | + $this->mutateValue(function($value) { |
|
| 30 | 30 | return implode(',', $value); |
| 31 | 31 | }); |
| 32 | 32 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $name = $this->getName(); |
| 39 | 39 | $value = Request::input($name, ''); |
| 40 | 40 | |
| 41 | - if (! empty($value)) { |
|
| 41 | + if (!empty($value)) { |
|
| 42 | 42 | $value = explode(',', $value); |
| 43 | 43 | } else { |
| 44 | 44 | $value = []; |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | if ($relation instanceof \Illuminate\Database\Eloquent\Relations\BelongsToMany) { |
| 136 | 136 | foreach ($values as $i => $value) { |
| 137 | - if (! array_key_exists($value, $this->getOptions()) and $this->isTaggable()) { |
|
| 137 | + if (!array_key_exists($value, $this->getOptions()) and $this->isTaggable()) { |
|
| 138 | 138 | $model = clone $this->getModelForOptions(); |
| 139 | 139 | $model->{$this->getDisplay()} = $value; |
| 140 | 140 | $model->save(); |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | $relation->sync($values); |
| 147 | 147 | } elseif ($relation instanceof \Illuminate\Database\Eloquent\Relations\HasMany) { |
| 148 | 148 | foreach ($relation->get() as $item) { |
| 149 | - if (! in_array($item->getKey(), $values)) { |
|
| 149 | + if (!in_array($item->getKey(), $values)) { |
|
| 150 | 150 | if ($this->isDeleteRelatedItem()) { |
| 151 | 151 | $item->delete(); |
| 152 | 152 | } else { |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $item = $model->find($value); |
| 163 | 163 | |
| 164 | 164 | if (is_null($item)) { |
| 165 | - if (! $this->isTaggable()) { |
|
| 165 | + if (!$this->isTaggable()) { |
|
| 166 | 166 | continue; |
| 167 | 167 | } |
| 168 | 168 | |
@@ -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,7 +27,7 @@ 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') { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function hashWithBcrypt() |
| 65 | 65 | { |
| 66 | - return $this->mutateValue(function ($value) { |
|
| 66 | + return $this->mutateValue(function($value) { |
|
| 67 | 67 | return bcrypt($value); |
| 68 | 68 | }); |
| 69 | 69 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function hashWithMD5() |
| 75 | 75 | { |
| 76 | - return $this->mutateValue(function ($value) { |
|
| 76 | + return $this->mutateValue(function($value) { |
|
| 77 | 77 | return md5($value); |
| 78 | 78 | }); |
| 79 | 79 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function hashWithSHA1() |
| 85 | 85 | { |
| 86 | - return $this->mutateValue(function ($value) { |
|
| 86 | + return $this->mutateValue(function($value) { |
|
| 87 | 87 | return sha1($value); |
| 88 | 88 | }); |
| 89 | 89 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | { |
| 84 | 84 | $name = array_shift($parts); |
| 85 | 85 | |
| 86 | - while (! empty($parts)) { |
|
| 86 | + while (!empty($parts)) { |
|
| 87 | 87 | $part = array_shift($parts); |
| 88 | 88 | $name .= "[$part]"; |
| 89 | 89 | } |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | { |
| 237 | 237 | $this->addValidationRule('_unique'); |
| 238 | 238 | |
| 239 | - if (! is_null($message)) { |
|
| 239 | + if (!is_null($message)) { |
|
| 240 | 240 | $this->addValidationMessage('unique', $message); |
| 241 | 241 | } |
| 242 | 242 | |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | */ |
| 272 | 272 | public function getValueFromRequest() |
| 273 | 273 | { |
| 274 | - if (Request::hasSession() && ! is_null($value = Request::old($this->getPath()))) { |
|
| 274 | + if (Request::hasSession() && !is_null($value = Request::old($this->getPath()))) { |
|
| 275 | 275 | return $value; |
| 276 | 276 | } |
| 277 | 277 | |
@@ -284,14 +284,14 @@ discard block |
||
| 284 | 284 | */ |
| 285 | 285 | public function getValue() |
| 286 | 286 | { |
| 287 | - if (! is_null($value = $this->getValueFromRequest())) { |
|
| 287 | + if (!is_null($value = $this->getValueFromRequest())) { |
|
| 288 | 288 | return $value; |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | $model = $this->getModel(); |
| 292 | 292 | $value = $this->getDefaultValue(); |
| 293 | 293 | |
| 294 | - if (is_null($model) or ! $model->exists) { |
|
| 294 | + if (is_null($model) or !$model->exists) { |
|
| 295 | 295 | return $value; |
| 296 | 296 | } |
| 297 | 297 | |
@@ -26,16 +26,16 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | $routeName = 'admin.form.element.'.static::$route; |
| 28 | 28 | |
| 29 | - if (! $router->has($routeName)) { |
|
| 30 | - $router->post('{adminModel}/'.static::$route.'/{field}/{id?}', ['as' => $routeName, function ( |
|
| 29 | + if (!$router->has($routeName)) { |
|
| 30 | + $router->post('{adminModel}/'.static::$route.'/{field}/{id?}', ['as' => $routeName, function( |
|
| 31 | 31 | Request $request, |
| 32 | 32 | ModelConfigurationInterface $model, |
| 33 | 33 | $field, |
| 34 | 34 | $id = null |
| 35 | 35 | ) { |
| 36 | - if (! is_null($id)) { |
|
| 36 | + if (!is_null($id)) { |
|
| 37 | 37 | $item = $model->getRepository()->find($id); |
| 38 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
| 38 | + if (is_null($item) || !$model->isEditable($item)) { |
|
| 39 | 39 | return new JsonResponse([ |
| 40 | 40 | 'message' => trans('lang.message.access_denied'), |
| 41 | 41 | ], 403); |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $form = $model->fireEdit($id); |
| 45 | 45 | } else { |
| 46 | - if (! $model->isCreatable()) { |
|
| 46 | + if (!$model->isCreatable()) { |
|
| 47 | 47 | return new JsonResponse([ |
| 48 | 48 | 'message' => trans('lang.message.access_denied'), |
| 49 | 49 | ], 403); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | $labels = []; |
| 57 | 57 | $rules = static::defaultUploadValidationRules(); |
| 58 | 58 | |
| 59 | - if (! is_null($element = $form->getElement($field))) { |
|
| 59 | + if (!is_null($element = $form->getElement($field))) { |
|
| 60 | 60 | $rules = $element->getUploadValidationRules(); |
| 61 | 61 | $messages = $element->getUploadValidationMessages(); |
| 62 | 62 | $labels = $element->getUploadValidationLabels(); |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $file = $request->file('file'); |
| 77 | 77 | |
| 78 | 78 | /** @var File $element */ |
| 79 | - if (! is_null($element = $form->getElement($field))) { |
|
| 79 | + if (!is_null($element = $form->getElement($field))) { |
|
| 80 | 80 | $filename = $element->getUploadFileName($file); |
| 81 | 81 | $path = $element->getUploadPath($file); |
| 82 | 82 | $settings = $element->getUploadSettings(); |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | public function getUploadPath(UploadedFile $file) |
| 204 | 204 | { |
| 205 | - if (! is_callable($this->uploadPath)) { |
|
| 205 | + if (!is_callable($this->uploadPath)) { |
|
| 206 | 206 | return static::defaultUploadPath($file); |
| 207 | 207 | } |
| 208 | 208 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | */ |
| 229 | 229 | public function getUploadFileName(UploadedFile $file) |
| 230 | 230 | { |
| 231 | - if (! is_callable($this->uploadFileName)) { |
|
| 231 | + if (!is_callable($this->uploadFileName)) { |
|
| 232 | 232 | return static::defaultUploadFilename($file); |
| 233 | 233 | } |
| 234 | 234 | |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | { |
| 47 | 47 | $this->view = $view; |
| 48 | 48 | |
| 49 | - $this->setDisplay(function ($model) { |
|
| 49 | + $this->setDisplay(function($model) { |
|
| 50 | 50 | $this->data['model'] = $model; |
| 51 | 51 | |
| 52 | 52 | return view($this->getView(), $this->data); |
@@ -162,7 +162,7 @@ |
||
| 162 | 162 | $filteredValue = $value; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - if (! empty($this->filteredFieldKey)) { |
|
| 165 | + if (!empty($this->filteredFieldKey)) { |
|
| 166 | 166 | parent::setValue($model, $attribute, $value); |
| 167 | 167 | parent::setValue($model, $this->filteredFieldKey, $filteredValue); |
| 168 | 168 | } else { |
@@ -17,16 +17,16 @@ discard block |
||
| 17 | 17 | { |
| 18 | 18 | $routeName = 'admin.form.element.dependent-select'; |
| 19 | 19 | |
| 20 | - if (! $router->has($routeName)) { |
|
| 21 | - $router->post('{adminModel}/dependent-select/{field}/{id?}', ['as' => $routeName, function ( |
|
| 20 | + if (!$router->has($routeName)) { |
|
| 21 | + $router->post('{adminModel}/dependent-select/{field}/{id?}', ['as' => $routeName, function( |
|
| 22 | 22 | Request $request, |
| 23 | 23 | ModelConfigurationInterface $model, |
| 24 | 24 | $field, |
| 25 | 25 | $id = null |
| 26 | 26 | ) { |
| 27 | - if (! is_null($id)) { |
|
| 27 | + if (!is_null($id)) { |
|
| 28 | 28 | $item = $model->getRepository()->find($id); |
| 29 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
| 29 | + if (is_null($item) || !$model->isEditable($item)) { |
|
| 30 | 30 | return new JsonResponse([ |
| 31 | 31 | 'message' => trans('lang.message.access_denied'), |
| 32 | 32 | ], 403); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | $form = $model->fireEdit($id); |
| 36 | 36 | } else { |
| 37 | - if (! $model->isCreatable()) { |
|
| 37 | + if (!$model->isCreatable()) { |
|
| 38 | 38 | return new JsonResponse([ |
| 39 | 39 | 'message' => trans('lang.message.access_denied'), |
| 40 | 40 | ], 403); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $options = array_except($options, $element->exclude); |
| 63 | 63 | |
| 64 | 64 | return new JsonResponse([ |
| 65 | - 'output' => collect($options)->map(function ($value, $key) { |
|
| 65 | + 'output' => collect($options)->map(function($value, $key) { |
|
| 66 | 66 | return ['id' => $key, 'name' => $value]; |
| 67 | 67 | }), |
| 68 | 68 | 'selected' => $element->getValue(), |
@@ -101,12 +101,12 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | parent::initialize(); |
| 103 | 103 | |
| 104 | - if (! $this->hasHtmlAttribute('enctype')) { |
|
| 104 | + if (!$this->hasHtmlAttribute('enctype')) { |
|
| 105 | 105 | // Try to find upload element |
| 106 | - $this->getElements()->each(function ($element) { |
|
| 106 | + $this->getElements()->each(function($element) { |
|
| 107 | 107 | |
| 108 | 108 | // TODO: this not works withs nested elements |
| 109 | - if ($element instanceof Upload and ! $this->hasHtmlAttribute('enctype')) { |
|
| 109 | + if ($element instanceof Upload and !$this->hasHtmlAttribute('enctype')) { |
|
| 110 | 110 | $this->setHtmlAttribute('enctype', 'multipart/form-data'); |
| 111 | 111 | } |
| 112 | 112 | }); |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | */ |
| 230 | 230 | public function setItems($items) |
| 231 | 231 | { |
| 232 | - if (! is_array($items)) { |
|
| 232 | + if (!is_array($items)) { |
|
| 233 | 233 | $items = func_get_args(); |
| 234 | 234 | } |
| 235 | 235 | |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | */ |
| 257 | 257 | public function setId($id) |
| 258 | 258 | { |
| 259 | - if (is_null($this->id) and ! is_null($id) and ($model = $this->getRepository()->find($id))) { |
|
| 259 | + if (is_null($this->id) and !is_null($id) and ($model = $this->getRepository()->find($id))) { |
|
| 260 | 260 | $this->id = $id; |
| 261 | 261 | |
| 262 | 262 | $this->setModel($model); |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | protected function saveBelongsToRelations(Model $model) |
| 343 | 343 | { |
| 344 | 344 | foreach ($model->getRelations() as $name => $relation) { |
| 345 | - if ($model->{$name}() instanceof BelongsTo && ! is_null($relation)) { |
|
| 345 | + if ($model->{$name}() instanceof BelongsTo && !is_null($relation)) { |
|
| 346 | 346 | $relation->save(); |
| 347 | 347 | $model->{$name}()->associate($relation); |
| 348 | 348 | } |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | protected function saveHasOneRelations(Model $model) |
| 358 | 358 | { |
| 359 | 359 | foreach ($model->getRelations() as $name => $relation) { |
| 360 | - if ($model->{$name}() instanceof HasOneOrMany && ! is_null($relation)) { |
|
| 360 | + if ($model->{$name}() instanceof HasOneOrMany && !is_null($relation)) { |
|
| 361 | 361 | if (is_array($relation) || $relation instanceof \Traversable) { |
| 362 | 362 | $model->{$name}()->saveMany($relation); |
| 363 | 363 | } else { |