@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public function getValueFromModel() |
80 | 80 | { |
81 | 81 | $value = parent::getValueFromModel(); |
82 | - if (! empty($value)) { |
|
82 | + if (!empty($value)) { |
|
83 | 83 | return $this->parseValue($value); |
84 | 84 | } |
85 | 85 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function setModelAttribute($value) |
113 | 113 | { |
114 | - $value = ! empty($value) |
|
114 | + $value = !empty($value) |
|
115 | 115 | ? Carbon::createFromFormat($this->getPickerFormat(), $value, $this->getTimezone()) |
116 | 116 | ->timezone(config('app.timezone'))->format($this->getFormat()) |
117 | 117 | : null; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | { |
24 | 24 | parent::__construct($path, $label); |
25 | 25 | |
26 | - $this->setLoadOptionsQueryPreparer(function ($item, Builder $query) { |
|
26 | + $this->setLoadOptionsQueryPreparer(function($item, Builder $query) { |
|
27 | 27 | $repository = app(RepositoryInterface::class); |
28 | 28 | $repository->setModel($this->getModelForOptions()); |
29 | 29 | $key = $repository->getModel()->getKeyName(); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | { |
40 | 40 | $routeName = 'admin.form.element.'.static::$route; |
41 | 41 | |
42 | - if (! $router->has($routeName)) { |
|
42 | + if (!$router->has($routeName)) { |
|
43 | 43 | $router->post('{adminModel}/'.static::$route.'/{field}/{id?}', [ |
44 | 44 | 'as' => $routeName, |
45 | 45 | 'uses' => 'SleepingOwl\Admin\Http\Controllers\FormElementController@selectSearch', |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | array $values |
196 | 196 | ) { |
197 | 197 | foreach ($values as $i => $value) { |
198 | - if (! array_key_exists($value, $this->getOptions()) && $this->isTaggable()) { |
|
198 | + if (!array_key_exists($value, $this->getOptions()) && $this->isTaggable()) { |
|
199 | 199 | $model = clone $this->getModelForOptions(); |
200 | 200 | $model->{$this->getDisplay()} = $value; |
201 | 201 | $model->save(); |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | $items = $relation->get(); |
226 | 226 | |
227 | 227 | foreach ($items as $item) { |
228 | - if (! in_array($item->getKey(), $values)) { |
|
228 | + if (!in_array($item->getKey(), $values)) { |
|
229 | 229 | if ($this->isDeleteRelatedItem()) { |
230 | 230 | $item->delete(); |
231 | 231 | } else { |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $item = $model->find($value); |
251 | 251 | |
252 | 252 | if (is_null($item)) { |
253 | - if (! $this->isTaggable()) { |
|
253 | + if (!$this->isTaggable()) { |
|
254 | 254 | continue; |
255 | 255 | } |
256 | 256 |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | { |
86 | 86 | $name = array_shift($parts); |
87 | 87 | |
88 | - while (! empty($parts)) { |
|
88 | + while (!empty($parts)) { |
|
89 | 89 | $part = array_shift($parts); |
90 | 90 | $name .= "[$part]"; |
91 | 91 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | { |
239 | 239 | $this->addValidationRule('_unique'); |
240 | 240 | |
241 | - if (! is_null($message)) { |
|
241 | + if (!is_null($message)) { |
|
242 | 242 | $this->addValidationMessage('unique', $message); |
243 | 243 | } |
244 | 244 | |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | */ |
347 | 347 | public function getValueFromRequest(\Illuminate\Http\Request $request) |
348 | 348 | { |
349 | - if ($request->hasSession() && ! is_null($value = $request->old($this->getPath()))) { |
|
349 | + if ($request->hasSession() && !is_null($value = $request->old($this->getPath()))) { |
|
350 | 350 | return $value; |
351 | 351 | } |
352 | 352 | |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | */ |
359 | 359 | public function getValueFromModel() |
360 | 360 | { |
361 | - if (! is_null($value = $this->getValueFromRequest(request()))) { |
|
361 | + if (!is_null($value = $this->getValueFromRequest(request()))) { |
|
362 | 362 | return $value; |
363 | 363 | } |
364 | 364 | |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | $path = $this->getPath(); |
367 | 367 | $value = $this->getDefaultValue(); |
368 | 368 | |
369 | - if (is_null($model) || ! $model->exists) { |
|
369 | + if (is_null($model) || !$model->exists) { |
|
370 | 370 | return $value; |
371 | 371 | } |
372 | 372 | |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | if ($count === 1) { |
397 | 397 | $attribute = $model->getAttribute($this->getModelAttributeKey()); |
398 | 398 | |
399 | - if (! empty($attribute) || $attribute === 0 || is_null($value)) { |
|
399 | + if (!empty($attribute) || $attribute === 0 || is_null($value)) { |
|
400 | 400 | return $attribute; |
401 | 401 | } |
402 | 402 | } |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | if ($count === 2) { |
411 | 411 | $attribute = $model->getAttribute($relation); |
412 | 412 | |
413 | - if (! empty($attribute) || is_null($value)) { |
|
413 | + if (!empty($attribute) || is_null($value)) { |
|
414 | 414 | return $attribute; |
415 | 415 | } |
416 | 416 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | { |
35 | 35 | parent::__construct($path, $label); |
36 | 36 | |
37 | - $this->setLoadOptionsQueryPreparer(function ($item, Builder $query) { |
|
37 | + $this->setLoadOptionsQueryPreparer(function($item, Builder $query) { |
|
38 | 38 | $repository = app(RepositoryInterface::class); |
39 | 39 | $repository->setModel($this->getModelForOptions()); |
40 | 40 | $key = $repository->getModel()->getKeyName(); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | { |
108 | 108 | $routeName = 'admin.form.element.'.static::$route; |
109 | 109 | |
110 | - if (! $router->has($routeName)) { |
|
110 | + if (!$router->has($routeName)) { |
|
111 | 111 | $router->post('{adminModel}/'.static::$route.'/{field}/{id?}', [ |
112 | 112 | 'as' => $routeName, |
113 | 113 | 'uses' => 'SleepingOwl\Admin\Http\Controllers\FormElementController@multiselectSearch', |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | $options = $repository->getQuery(); |
176 | 176 | $relation = $this->getModelAttributeKey(); |
177 | 177 | |
178 | - if ($this->isEmptyRelation() && ! is_null($foreignKey = $this->getForeignKey())) { |
|
178 | + if ($this->isEmptyRelation() && !is_null($foreignKey = $this->getForeignKey())) { |
|
179 | 179 | $model = $this->getModel(); |
180 | 180 | |
181 | 181 | if ($model->{$relation}() instanceof HasOneOrMany) { |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | } |
191 | 191 | |
192 | 192 | // call the pre load options query preparer if has be set |
193 | - if (! is_null($preparer = $this->getLoadOptionsQueryPreparer())) { |
|
193 | + if (!is_null($preparer = $this->getLoadOptionsQueryPreparer())) { |
|
194 | 194 | $options = $preparer($this, $options); |
195 | 195 | } |
196 | 196 | |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | |
209 | 209 | // iterate for all options and redefine it as |
210 | 210 | // list of KEY and TEXT pair |
211 | - $options = array_map(function ($opt) use ($key, $makeDisplay) { |
|
211 | + $options = array_map(function($opt) use ($key, $makeDisplay) { |
|
212 | 212 | // get the KEY and make the display text |
213 | 213 | return [data_get($opt, $key), $makeDisplay($opt)]; |
214 | 214 | }, $options); |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | { |
236 | 236 | $attribute = $this->getModelAttributeKey(); |
237 | 237 | |
238 | - if (! method_exists($this->getModel(), $attribute)) { |
|
238 | + if (!method_exists($this->getModel(), $attribute)) { |
|
239 | 239 | return; |
240 | 240 | } |
241 | 241 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | { |
34 | 34 | $value = $this->getValueFromModel(); |
35 | 35 | |
36 | - if (! $this->isAllowedEmptyValue() && $this->getModel()->exists && empty($value)) { |
|
36 | + if (!$this->isAllowedEmptyValue() && $this->getModel()->exists && empty($value)) { |
|
37 | 37 | return; |
38 | 38 | } |
39 | 39 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | { |
48 | 48 | $data = parent::getValidationRules(); |
49 | 49 | |
50 | - if (! $this->isAllowedEmptyValue() && $this->getModel()->exists) { |
|
50 | + if (!$this->isAllowedEmptyValue() && $this->getModel()->exists) { |
|
51 | 51 | foreach ($data as $field => $rules) { |
52 | 52 | foreach ($rules as $i => $rule) { |
53 | 53 | if ($rule == 'required') { |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function hashWithBcrypt() |
85 | 85 | { |
86 | - return $this->mutateValue(function ($value) { |
|
86 | + return $this->mutateValue(function($value) { |
|
87 | 87 | return bcrypt($value); |
88 | 88 | }); |
89 | 89 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function hashWithMD5() |
95 | 95 | { |
96 | - return $this->mutateValue(function ($value) { |
|
96 | + return $this->mutateValue(function($value) { |
|
97 | 97 | return md5($value); |
98 | 98 | }); |
99 | 99 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function hashWithSHA1() |
105 | 105 | { |
106 | - return $this->mutateValue(function ($value) { |
|
106 | + return $this->mutateValue(function($value) { |
|
107 | 107 | return sha1($value); |
108 | 108 | }); |
109 | 109 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function set($filters) |
43 | 43 | { |
44 | - if (! is_array($filters)) { |
|
44 | + if (!is_array($filters)) { |
|
45 | 45 | $filters = func_get_args(); |
46 | 46 | } |
47 | 47 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function getActive() |
81 | 81 | { |
82 | - return $this->filters->filter(function (FilterInterface $filter) { |
|
82 | + return $this->filters->filter(function(FilterInterface $filter) { |
|
83 | 83 | return $filter->isActive(); |
84 | 84 | }); |
85 | 85 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function modifyQuery(Builder $query) |
127 | 127 | { |
128 | - $this->getActive()->each(function (FilterInterface $filter) use ($query) { |
|
128 | + $this->getActive()->each(function(FilterInterface $filter) use ($query) { |
|
129 | 129 | $filter->apply($query); |
130 | 130 | }); |
131 | 131 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function initialize() |
137 | 137 | { |
138 | - $this->filters->each(function (FilterInterface $filter) { |
|
138 | + $this->filters->each(function(FilterInterface $filter) { |
|
139 | 139 | $filter->initialize(); |
140 | 140 | }); |
141 | 141 | } |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | parent::initialize(); |
72 | 72 | |
73 | 73 | if ($this->getModelConfiguration()->isRestorableModel()) { |
74 | - $this->setApply(function (Builder $q) { |
|
74 | + $this->setApply(function(Builder $q) { |
|
75 | 75 | return $q->withTrashed(); |
76 | 76 | }); |
77 | 77 | } |
@@ -193,11 +193,11 @@ discard block |
||
193 | 193 | */ |
194 | 194 | public function getCollection() |
195 | 195 | { |
196 | - if (! $this->isInitialized()) { |
|
196 | + if (!$this->isInitialized()) { |
|
197 | 197 | throw new \Exception('Display is not initialized'); |
198 | 198 | } |
199 | 199 | |
200 | - if (! is_null($this->collection)) { |
|
200 | + if (!is_null($this->collection)) { |
|
201 | 201 | return $this->collection; |
202 | 202 | } |
203 | 203 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | public static function registerRoutes(Router $router) |
27 | 27 | { |
28 | 28 | $routeName = 'admin.display.async'; |
29 | - if (! $router->has($routeName)) { |
|
29 | + if (!$router->has($routeName)) { |
|
30 | 30 | $router->get('{adminModel}/async/{adminDisplayName?}', [ |
31 | 31 | 'as' => $routeName, |
32 | 32 | 'uses' => 'SleepingOwl\Admin\Http\Controllers\DisplayController@async', |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | $routeName = 'admin.display.async.inlineEdit'; |
37 | - if (! $router->has($routeName)) { |
|
37 | + if (!$router->has($routeName)) { |
|
38 | 38 | $router->post('{adminModel}/async/{adminDisplayName?}', [ |
39 | 39 | 'as' => $routeName, |
40 | 40 | 'uses' => 'SleepingOwl\Admin\Http\Controllers\AdminController@inlineEdit', |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $totalCount = $query->count(); |
204 | 204 | $filteredCount = 0; |
205 | 205 | |
206 | - if (! is_null($this->distinct)) { |
|
206 | + if (!is_null($this->distinct)) { |
|
207 | 207 | $filteredCount = $query->distinct()->count($this->getDistinct()); |
208 | 208 | } |
209 | 209 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | return; |
254 | 254 | } |
255 | 255 | |
256 | - $query->where(function (Builder $query) use ($search) { |
|
256 | + $query->where(function(Builder $query) use ($search) { |
|
257 | 257 | $columns = $this->getColumns()->all(); |
258 | 258 | |
259 | 259 | foreach ($columns as $column) { |