@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | public static function registerRoutes(Router $router) |
24 | 24 | { |
25 | 25 | $routeName = 'admin.display.tree.reorder'; |
26 | - if (! $router->has($routeName)) { |
|
27 | - $router->post('{adminModel}/reorder', ['as' => $routeName, function (ModelConfigurationInterface $model) { |
|
26 | + if (!$router->has($routeName)) { |
|
27 | + $router->post('{adminModel}/reorder', [ 'as' => $routeName, function(ModelConfigurationInterface $model) { |
|
28 | 28 | $model->fireDisplay()->getRepository()->reorder( |
29 | 29 | Request::input('data') |
30 | 30 | ); |
31 | - }]); |
|
31 | + } ]); |
|
32 | 32 | } |
33 | 33 | } |
34 | 34 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | /** |
41 | 41 | * @var array |
42 | 42 | */ |
43 | - protected $parameters = []; |
|
43 | + protected $parameters = [ ]; |
|
44 | 44 | |
45 | 45 | /** |
46 | 46 | * @var bool |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | */ |
209 | 209 | public function setParameter($key, $value) |
210 | 210 | { |
211 | - $this->parameters[$key] = $value; |
|
211 | + $this->parameters[ $key ] = $value; |
|
212 | 212 | |
213 | 213 | return $this; |
214 | 214 | } |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | 'value' => $this->getValue(), |
256 | 256 | 'creatable' => $model->isCreatable(), |
257 | 257 | 'createUrl' => $model->getCreateUrl($this->getParameters() + Request::all()), |
258 | - 'controls' => [app('sleeping_owl.table.column')->treeControl()], |
|
258 | + 'controls' => [ app('sleeping_owl.table.column')->treeControl() ], |
|
259 | 259 | ]; |
260 | 260 | } |
261 | 261 | |
@@ -273,11 +273,11 @@ discard block |
||
273 | 273 | */ |
274 | 274 | public function getCollection() |
275 | 275 | { |
276 | - if (! $this->isInitialized()) { |
|
276 | + if (!$this->isInitialized()) { |
|
277 | 277 | throw new \Exception('Display is not initialized'); |
278 | 278 | } |
279 | 279 | |
280 | - if (! is_null($this->collection)) { |
|
280 | + if (!is_null($this->collection)) { |
|
281 | 281 | return $this->collection; |
282 | 282 | } |
283 | 283 | |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | */ |
294 | 294 | protected function modifyQuery(\Illuminate\Database\Eloquent\Builder $query) |
295 | 295 | { |
296 | - $this->extensions->each(function (DisplayExtensionInterface $extension) use ($query) { |
|
296 | + $this->extensions->each(function(DisplayExtensionInterface $extension) use ($query) { |
|
297 | 297 | $extension->modifyQuery($query); |
298 | 298 | }); |
299 | 299 | } |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | { |
307 | 307 | $repository = parent::makeRepository(); |
308 | 308 | |
309 | - if (! ($repository instanceof TreeRepositoryInterface)) { |
|
309 | + if (!($repository instanceof TreeRepositoryInterface)) { |
|
310 | 310 | throw new \Exception('Repository class must be instanced of [TreeRepositoryInterface]'); |
311 | 311 | } |
312 | 312 |
@@ -38,8 +38,8 @@ |
||
38 | 38 | $relationName = implode('.', $parts); |
39 | 39 | } |
40 | 40 | |
41 | - if (! is_null($relationName)) { |
|
42 | - $query->whereHas($relationName, function ($q) use ($name, $value) { |
|
41 | + if (!is_null($relationName)) { |
|
42 | + $query->whereHas($relationName, function($q) use ($name, $value) { |
|
43 | 43 | $this->buildQuery($q, $name, $value); |
44 | 44 | }); |
45 | 45 | } else { |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $this->setName($name); |
38 | 38 | $this->setAlias($name); |
39 | 39 | |
40 | - if (! is_null($title)) { |
|
40 | + if (!is_null($title)) { |
|
41 | 41 | $this->setTitle($title); |
42 | 42 | } |
43 | 43 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | return call_user_func($this->title, $this->getValue()); |
104 | 104 | } |
105 | 105 | |
106 | - return strtr($this->title, [':value' => $this->getValue()]); |
|
106 | + return strtr($this->title, [ ':value' => $this->getValue() ]); |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
@@ -143,6 +143,6 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public function isActive() |
145 | 145 | { |
146 | - return ! is_null($this->getValue()); |
|
146 | + return !is_null($this->getValue()); |
|
147 | 147 | } |
148 | 148 | } |
@@ -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 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | $this->initializeElements(); |
45 | 45 | |
46 | - $activeTabs = $this->getTabs()->filter(function (TabInterface $tab) { |
|
46 | + $activeTabs = $this->getTabs()->filter(function(TabInterface $tab) { |
|
47 | 47 | return $tab->isActive(); |
48 | 48 | })->count(); |
49 | 49 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function setModelClass($class) |
59 | 59 | { |
60 | - $this->getTabs()->each(function (TabInterface $tab) use ($class) { |
|
60 | + $this->getTabs()->each(function(TabInterface $tab) use ($class) { |
|
61 | 61 | if ($tab instanceof DisplayInterface) { |
62 | 62 | $tab->setModelClass($class); |
63 | 63 | } |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | */ |
138 | 138 | public function setAction($action) |
139 | 139 | { |
140 | - $this->getTabs()->each(function (TabInterface $tab) use ($action) { |
|
140 | + $this->getTabs()->each(function(TabInterface $tab) use ($action) { |
|
141 | 141 | if ($tab instanceof FormInterface) { |
142 | 142 | $tab->setAction($action); |
143 | 143 | } |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | */ |
150 | 150 | public function setId($id) |
151 | 151 | { |
152 | - $this->getTabs()->each(function (TabInterface $tab) use ($id) { |
|
152 | + $this->getTabs()->each(function(TabInterface $tab) use ($id) { |
|
153 | 153 | if ($tab instanceof FormInterface) { |
154 | 154 | $tab->setId($id); |
155 | 155 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | foreach ($this->getTabs() as $tab) { |
167 | 167 | if ($tab instanceof FormInterface) { |
168 | 168 | $result = $tab->validateForm($model); |
169 | - if (! is_null($result)) { |
|
169 | + if (!is_null($result)) { |
|
170 | 170 | return $result; |
171 | 171 | } |
172 | 172 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function saveForm(ModelConfigurationInterface $model) |
180 | 180 | { |
181 | - $this->getTabs()->each(function (TabInterface $tab) use ($model) { |
|
181 | + $this->getTabs()->each(function(TabInterface $tab) use ($model) { |
|
182 | 182 | if ($tab instanceof FormInterface) { |
183 | 183 | $tab->saveForm($model); |
184 | 184 | } |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | */ |
33 | 33 | public function fireDisplay() |
34 | 34 | { |
35 | - if (! method_exists($this, 'onDisplay')) { |
|
35 | + if (!method_exists($this, 'onDisplay')) { |
|
36 | 36 | return; |
37 | 37 | } |
38 | 38 | |
39 | - $display = app()->call([$this, 'onDisplay']); |
|
39 | + $display = app()->call([ $this, 'onDisplay' ]); |
|
40 | 40 | |
41 | 41 | if ($display instanceof DisplayInterface) { |
42 | 42 | $display->setModelClass($this->getClass()); |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function fireCreate() |
53 | 53 | { |
54 | - if (! method_exists($this, 'onCreate')) { |
|
54 | + if (!method_exists($this, 'onCreate')) { |
|
55 | 55 | return; |
56 | 56 | } |
57 | 57 | |
58 | - $form = app()->call([$this, 'onCreate']); |
|
58 | + $form = app()->call([ $this, 'onCreate' ]); |
|
59 | 59 | if ($form instanceof DisplayInterface) { |
60 | 60 | $form->setModelClass($this->getClass()); |
61 | 61 | } |
@@ -78,11 +78,11 @@ discard block |
||
78 | 78 | */ |
79 | 79 | public function fireEdit($id) |
80 | 80 | { |
81 | - if (! method_exists($this, 'onEdit')) { |
|
81 | + if (!method_exists($this, 'onEdit')) { |
|
82 | 82 | return; |
83 | 83 | } |
84 | 84 | |
85 | - $form = app()->call([$this, 'onEdit'], ['id' => $id]); |
|
85 | + $form = app()->call([ $this, 'onEdit' ], [ 'id' => $id ]); |
|
86 | 86 | if ($form instanceof DisplayInterface) { |
87 | 87 | $form->setModelClass($this->getClass()); |
88 | 88 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | public function fireDelete($id) |
108 | 108 | { |
109 | 109 | if (method_exists($this, 'onDelete')) { |
110 | - return app()->call([$this, 'onDelete'], ['id' => $id]); |
|
110 | + return app()->call([ $this, 'onDelete' ], [ 'id' => $id ]); |
|
111 | 111 | } |
112 | 112 | } |
113 | 113 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | public function fireDestroy($id) |
120 | 120 | { |
121 | 121 | if (method_exists($this, 'onDestroy')) { |
122 | - return app()->call([$this, 'onDestroy'], ['id' => $id]); |
|
122 | + return app()->call([ $this, 'onDestroy' ], [ 'id' => $id ]); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | public function fireRestore($id) |
132 | 132 | { |
133 | 133 | if (method_exists($this, 'onRestore')) { |
134 | - return app()->call([$this, 'onRestore'], ['id' => $id]); |
|
134 | + return app()->call([ $this, 'onRestore' ], [ 'id' => $id ]); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | } |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | */ |
334 | 334 | public function isCreatable() |
335 | 335 | { |
336 | - if (! is_callable($this->getCreate())) { |
|
336 | + if (!is_callable($this->getCreate())) { |
|
337 | 337 | return false; |
338 | 338 | } |
339 | 339 | |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | */ |
358 | 358 | public function isEditable(Model $model) |
359 | 359 | { |
360 | - if (! is_callable($this->getEdit())) { |
|
360 | + if (!is_callable($this->getEdit())) { |
|
361 | 361 | return false; |
362 | 362 | } |
363 | 363 | |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | */ |
468 | 468 | public function fireDisplay() |
469 | 469 | { |
470 | - if (! is_callable($this->display)) { |
|
470 | + if (!is_callable($this->display)) { |
|
471 | 471 | return; |
472 | 472 | } |
473 | 473 | |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | */ |
486 | 486 | public function fireCreate() |
487 | 487 | { |
488 | - if (! is_callable($this->create)) { |
|
488 | + if (!is_callable($this->create)) { |
|
489 | 489 | return; |
490 | 490 | } |
491 | 491 | |
@@ -512,11 +512,11 @@ discard block |
||
512 | 512 | */ |
513 | 513 | public function fireEdit($id) |
514 | 514 | { |
515 | - if (! is_callable($this->edit)) { |
|
515 | + if (!is_callable($this->edit)) { |
|
516 | 516 | return; |
517 | 517 | } |
518 | 518 | |
519 | - $form = app()->call($this->edit, ['id' => $id]); |
|
519 | + $form = app()->call($this->edit, [ 'id' => $id ]); |
|
520 | 520 | if ($form instanceof DisplayInterface) { |
521 | 521 | $form->setModelClass($this->getClass()); |
522 | 522 | } |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | public function fireDelete($id) |
542 | 542 | { |
543 | 543 | if (is_callable($this->getDelete())) { |
544 | - return app()->call($this->getDelete(), [$id]); |
|
544 | + return app()->call($this->getDelete(), [ $id ]); |
|
545 | 545 | } |
546 | 546 | } |
547 | 547 | |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | public function fireDestroy($id) |
554 | 554 | { |
555 | 555 | if (is_callable($this->getDestroy())) { |
556 | - return app()->call($this->getDestroy(), [$id]); |
|
556 | + return app()->call($this->getDestroy(), [ $id ]); |
|
557 | 557 | } |
558 | 558 | } |
559 | 559 | |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | public function fireRestore($id) |
566 | 566 | { |
567 | 567 | if (is_callable($this->getRestore())) { |
568 | - return app()->call($this->getRestore(), [$id]); |
|
568 | + return app()->call($this->getRestore(), [ $id ]); |
|
569 | 569 | } |
570 | 570 | |
571 | 571 | return $this->getRestore(); |
@@ -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 | } |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | $messages = parent::getValidationMessages(); |
286 | 286 | |
287 | 287 | foreach ($this->validationMessages as $rule => $message) { |
288 | - $messages[$this->getName().'.'.$rule] = $message; |
|
288 | + $messages[ $this->getName().'.'.$rule ] = $message; |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | return $messages; |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | $rule = substr($rule, 0, $pos); |
316 | 316 | } |
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 | /** |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | */ |
334 | 334 | public function getValueFromRequest() |
335 | 335 | { |
336 | - if (! is_null($value = Request::old($this->getPath()))) { |
|
336 | + if (!is_null($value = Request::old($this->getPath()))) { |
|
337 | 337 | return $value; |
338 | 338 | } |
339 | 339 | |
@@ -346,14 +346,14 @@ discard block |
||
346 | 346 | */ |
347 | 347 | public function getValue() |
348 | 348 | { |
349 | - if (! is_null($value = $this->getValueFromRequest())) { |
|
349 | + if (!is_null($value = $this->getValueFromRequest())) { |
|
350 | 350 | return $value; |
351 | 351 | } |
352 | 352 | |
353 | 353 | $model = $this->getModel(); |
354 | 354 | $value = $this->getDefaultValue(); |
355 | 355 | |
356 | - if (is_null($model) or ! $model->exists) { |
|
356 | + if (is_null($model) or !$model->exists) { |
|
357 | 357 | return $value; |
358 | 358 | } |
359 | 359 | |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | } |
406 | 406 | unset($rule); |
407 | 407 | |
408 | - return [$this->getPath() => $rules]; |
|
408 | + return [ $this->getPath() => $rules ]; |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | /** |
@@ -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,17 +344,17 @@ discard block |
||
344 | 344 | ]; |
345 | 345 | |
346 | 346 | if ($this->isReadonly()) { |
347 | - $attributes['disabled'] = 'disabled'; |
|
347 | + $attributes[ 'disabled' ] = 'disabled'; |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | if ($this->isNullable()) { |
351 | - $attributes['data-nullable'] = 'true'; |
|
351 | + $attributes[ 'data-nullable' ] = 'true'; |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | $options = $this->getOptions(); |
355 | 355 | |
356 | 356 | if ($this->isNullable()) { |
357 | - $options = [null => trans('sleeping_owl::lang.select.nothing')] + $options; |
|
357 | + $options = [ null => trans('sleeping_owl::lang.select.nothing') ] + $options; |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | $options = array_except($options, $this->exclude); |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | */ |
372 | 372 | protected function loadOptions() |
373 | 373 | { |
374 | - $repository = app(RepositoryInterface::class, [$this->getModelForOptions()]); |
|
374 | + $repository = app(RepositoryInterface::class, [ $this->getModelForOptions() ]); |
|
375 | 375 | |
376 | 376 | $key = $repository->getModel()->getKeyName(); |
377 | 377 | |
@@ -382,12 +382,12 @@ discard block |
||
382 | 382 | } |
383 | 383 | |
384 | 384 | if (count($this->fetchColumns) > 0) { |
385 | - $columns = array_merge([$key], $this->fetchColumns); |
|
385 | + $columns = array_merge([ $key ], $this->fetchColumns); |
|
386 | 386 | $options->select($columns); |
387 | 387 | } |
388 | 388 | |
389 | 389 | // call the pre load options query preparer if has be set |
390 | - if (! is_null($preparer = $this->getLoadOptionsQueryPreparer())) { |
|
390 | + if (!is_null($preparer = $this->getLoadOptionsQueryPreparer())) { |
|
391 | 391 | $options = $preparer($this, $options); |
392 | 392 | } |
393 | 393 | |
@@ -404,9 +404,9 @@ discard block |
||
404 | 404 | |
405 | 405 | // iterate for all options and redefine it as |
406 | 406 | // list of KEY and TEXT pair |
407 | - $options = array_map(function ($opt) use ($key, $makeDisplay) { |
|
407 | + $options = array_map(function($opt) use ($key, $makeDisplay) { |
|
408 | 408 | // get the KEY and make the display text |
409 | - return [data_get($opt, $key), $makeDisplay($opt)]; |
|
409 | + return [ data_get($opt, $key), $makeDisplay($opt) ]; |
|
410 | 410 | }, $options); |
411 | 411 | |
412 | 412 | // take options as array with KEY => VALUE pair |