@@ -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 { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $element = new Column($element); |
66 | 66 | } |
67 | 67 | |
68 | - if (! ($element instanceof ColumnInterface)) { |
|
68 | + if (!($element instanceof ColumnInterface)) { |
|
69 | 69 | throw new \Exception('Column should be instance of ColumnInterface'); |
70 | 70 | } |
71 | 71 | |
@@ -80,16 +80,16 @@ discard block |
||
80 | 80 | { |
81 | 81 | $this->setHtmlAttribute('class', 'row'); |
82 | 82 | |
83 | - $count = $this->getElements()->filter(function (ColumnInterface $column) { |
|
83 | + $count = $this->getElements()->filter(function(ColumnInterface $column) { |
|
84 | 84 | return $column->getWidth() === 0; |
85 | 85 | })->count(); |
86 | 86 | |
87 | - $width = $this->maxWidth - $this->getElements()->sum(function (ColumnInterface $column) { |
|
87 | + $width = $this->maxWidth - $this->getElements()->sum(function(ColumnInterface $column) { |
|
88 | 88 | return $column->getWidth(); |
89 | 89 | }); |
90 | 90 | |
91 | - $this->getElements()->each(function (ColumnInterface $column) use ($width, $count) { |
|
92 | - if (! $column->getWidth()) { |
|
91 | + $this->getElements()->each(function(ColumnInterface $column) use ($width, $count) { |
|
92 | + if (!$column->getWidth()) { |
|
93 | 93 | $column->setWidth(floor($width / $count)); |
94 | 94 | } |
95 | 95 | }); |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | */ |
130 | 130 | public function setSize($size) |
131 | 131 | { |
132 | - $this->getColumns()->each(function (ColumnInterface $column) use ($size) { |
|
132 | + $this->getColumns()->each(function(ColumnInterface $column) use ($size) { |
|
133 | 133 | $column->setSize($size); |
134 | 134 | }); |
135 | 135 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $model = new $model; |
69 | 69 | } |
70 | 70 | |
71 | - if (! ($model instanceof Model)) { |
|
71 | + if (!($model instanceof Model)) { |
|
72 | 72 | throw new \Exception('Model must be an instance of Illuminate\Database\Eloquent\Model'); |
73 | 73 | } |
74 | 74 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function getOptions() |
124 | 124 | { |
125 | - if (! is_null($this->getModel()) and ! is_null($this->getDisplay())) { |
|
125 | + if (!is_null($this->getModel()) and !is_null($this->getDisplay())) { |
|
126 | 126 | $this->loadOptions(); |
127 | 127 | } |
128 | 128 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $parts = explode('.', $name); |
209 | 209 | $fieldName = array_pop($parts); |
210 | 210 | $relationName = implode('.', $parts); |
211 | - $query->whereHas($relationName, function ($q) use ($search, $fieldName) { |
|
211 | + $query->whereHas($relationName, function($q) use ($search, $fieldName) { |
|
212 | 212 | $this->buildQuery($q, $fieldName, $search); |
213 | 213 | }); |
214 | 214 | } |