@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $modelForOptions = app($modelForOptions); |
65 | 65 | } |
66 | 66 | |
67 | - if (! ($modelForOptions instanceof Model)) { |
|
67 | + if (!($modelForOptions instanceof Model)) { |
|
68 | 68 | throw new SelectException('Class must be instanced of Illuminate\Database\Eloquent\Model'); |
69 | 69 | } |
70 | 70 | |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function setFetchColumns($columns) |
123 | 123 | { |
124 | - if (! is_array($columns)) { |
|
124 | + if (!is_array($columns)) { |
|
125 | 125 | $columns = func_get_args(); |
126 | 126 | } |
127 | 127 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | $options = $repository->getQuery(); |
218 | 218 | |
219 | - if ($this->isEmptyRelation() && ! is_null($foreignKey = $this->getForeignKey())) { |
|
219 | + if ($this->isEmptyRelation() && !is_null($foreignKey = $this->getForeignKey())) { |
|
220 | 220 | $relation = $this->getModelAttributeKey(); |
221 | 221 | $model = $this->getModel(); |
222 | 222 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | } |
233 | 233 | |
234 | 234 | // call the pre load options query preparer if has be set |
235 | - if (! is_null($preparer = $this->getLoadOptionsQueryPreparer())) { |
|
235 | + if (!is_null($preparer = $this->getLoadOptionsQueryPreparer())) { |
|
236 | 236 | $options = $preparer($this, $options); |
237 | 237 | } |
238 | 238 | |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | |
247 | 247 | // iterate for all options and redefine it as |
248 | 248 | // list of KEY and TEXT pair |
249 | - $options = array_map(function ($opt) use ($key, $makeDisplay) { |
|
249 | + $options = array_map(function($opt) use ($key, $makeDisplay) { |
|
250 | 250 | // get the KEY and make the display text |
251 | 251 | return [data_get($opt, $key), $makeDisplay($opt)]; |
252 | 252 | }, $options); |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function initializeElements() |
25 | 25 | { |
26 | - $this->getElements()->each(function ($element) { |
|
26 | + $this->getElements()->each(function($element) { |
|
27 | 27 | if ($element instanceof Initializable) { |
28 | 28 | $element->initialize(); |
29 | 29 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | foreach ($this->getElements() as $element) { |
43 | 43 | if ($element instanceof ElementsInterface) { |
44 | - if (! is_null($found = $element->getElement($path))) { |
|
44 | + if (!is_null($found = $element->getElement($path))) { |
|
45 | 45 | return $found; |
46 | 46 | } |
47 | 47 | } |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | protected function setModelForElements(Model $model) |
147 | 147 | { |
148 | - $this->getElements()->each(function ($element) use ($model) { |
|
148 | + $this->getElements()->each(function($element) use ($model) { |
|
149 | 149 | $element = $this->getElementContainer($element); |
150 | 150 | |
151 | 151 | if ($element instanceof WithModelInterface) { |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | protected function getValidationRulesFromElements(array $rules = []) |
165 | 165 | { |
166 | - $this->getElements()->onlyActive()->each(function ($element) use (&$rules) { |
|
166 | + $this->getElements()->onlyActive()->each(function($element) use (&$rules) { |
|
167 | 167 | $element = $this->getElementContainer($element); |
168 | 168 | |
169 | 169 | if ($element instanceof Validable) { |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | */ |
182 | 182 | protected function getValidationMessagesForElements(array $messages = []) |
183 | 183 | { |
184 | - $this->getElements()->onlyActive()->each(function ($element) use (&$messages) { |
|
184 | + $this->getElements()->onlyActive()->each(function($element) use (&$messages) { |
|
185 | 185 | $element = $this->getElementContainer($element); |
186 | 186 | |
187 | 187 | if ($element instanceof Validable) { |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | */ |
200 | 200 | protected function getValidationLabelsForElements(array $labels = []) |
201 | 201 | { |
202 | - $this->getElements()->onlyActive()->each(function ($element) use (&$labels) { |
|
202 | + $this->getElements()->onlyActive()->each(function($element) use (&$labels) { |
|
203 | 203 | $element = $this->getElementContainer($element); |
204 | 204 | |
205 | 205 | if ($element instanceof Validable) { |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | protected function saveElements(\Illuminate\Http\Request $request) |
219 | 219 | { |
220 | - $this->getElements()->onlyActive()->each(function ($element) use ($request) { |
|
220 | + $this->getElements()->onlyActive()->each(function($element) use ($request) { |
|
221 | 221 | $element = $this->getElementContainer($element); |
222 | 222 | |
223 | 223 | if ($element instanceof FormElementInterface) { |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | */ |
234 | 234 | protected function afterSaveElements(\Illuminate\Http\Request $request) |
235 | 235 | { |
236 | - $this->getElements()->onlyActive()->each(function ($element) use ($request) { |
|
236 | + $this->getElements()->onlyActive()->each(function($element) use ($request) { |
|
237 | 237 | $element = $this->getElementContainer($element); |
238 | 238 | |
239 | 239 | if ($element instanceof FormElementInterface) { |
@@ -2,8 +2,8 @@ |
||
2 | 2 | |
3 | 3 | use Illuminate\Routing\Router; |
4 | 4 | |
5 | -$router->group(['as' => 'admin.', 'namespace' => 'SleepingOwl\Admin\Http\Controllers'], function (Router $router) { |
|
6 | - if (! $router->has('admin.dashboard')) { |
|
5 | +$router->group(['as' => 'admin.', 'namespace' => 'SleepingOwl\Admin\Http\Controllers'], function(Router $router) { |
|
6 | + if (!$router->has('admin.dashboard')) { |
|
7 | 7 | $router->get('', ['as' => 'dashboard', 'uses' => 'AdminController@getDashboard']); |
8 | 8 | } |
9 | 9 |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function getModelLogic(ModelConfigurationInterface $model, $id = null) |
20 | 20 | { |
21 | - if (! is_null($id)) { |
|
21 | + if (!is_null($id)) { |
|
22 | 22 | $item = $model->getRepository()->find($id); |
23 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
23 | + if (is_null($item) || !$model->isEditable($item)) { |
|
24 | 24 | return new JsonResponse([ |
25 | 25 | 'message' => trans('lang.message.access_denied'), |
26 | 26 | ], 403); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | return $model->fireEdit($id); |
30 | 30 | } |
31 | 31 | |
32 | - if (! $model->isCreatable()) { |
|
32 | + if (!$model->isCreatable()) { |
|
33 | 33 | return new JsonResponse([ |
34 | 34 | 'message' => trans('lang.message.access_denied'), |
35 | 35 | ], 403); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | return new JsonResponse([ |
77 | - 'output' => collect($options)->map(function ($value, $key) { |
|
77 | + 'output' => collect($options)->map(function($value, $key) { |
|
78 | 78 | return ['id' => $key, 'name' => $value]; |
79 | 79 | }), |
80 | 80 | 'selected' => $element->getValueFromModel(), |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | return new JsonResponse( |
127 | 127 | $model::where($request->search, 'like', "%{$request->q}%") |
128 | 128 | ->get() |
129 | - ->map(function (Model $item) use ($field) { |
|
129 | + ->map(function(Model $item) use ($field) { |
|
130 | 130 | return [ |
131 | 131 | 'tag_name' => $item->{$field}, |
132 | 132 | 'id' => $item->id, |
@@ -86,7 +86,7 @@ |
||
86 | 86 | $display = $model->fireDisplay(); |
87 | 87 | |
88 | 88 | if ($display instanceof DisplayTabbed) { |
89 | - $display->getTabs()->each(function (DisplayTab $tab) use ($request) { |
|
89 | + $display->getTabs()->each(function(DisplayTab $tab) use ($request) { |
|
90 | 90 | $content = $tab->getContent(); |
91 | 91 | if ($content instanceof DisplayTree) { |
92 | 92 | $content->getRepository()->reorder( |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | |
61 | 61 | $admin->navigation()->setCurrentUrl($request->getUri()); |
62 | 62 | |
63 | - if (! $this->breadcrumbs->exists('home')) { |
|
64 | - $this->breadcrumbs->register('home', function (Generator $breadcrumbs) { |
|
63 | + if (!$this->breadcrumbs->exists('home')) { |
|
64 | + $this->breadcrumbs->register('home', function(Generator $breadcrumbs) { |
|
65 | 65 | $breadcrumbs->push(trans('sleeping_owl::lang.dashboard'), route('admin.dashboard')); |
66 | 66 | }); |
67 | 67 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function getDisplay(ModelConfigurationInterface $model) |
120 | 120 | { |
121 | - if (! $model->isDisplayable()) { |
|
121 | + if (!$model->isDisplayable()) { |
|
122 | 122 | abort(404); |
123 | 123 | } |
124 | 124 | |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | public function getCreate(ModelConfigurationInterface $model) |
140 | 140 | { |
141 | - if (! $model->isCreatable()) { |
|
141 | + if (!$model->isCreatable()) { |
|
142 | 142 | abort(404); |
143 | 143 | } |
144 | 144 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | */ |
159 | 159 | public function postStore(ModelConfigurationInterface $model, Request $request) |
160 | 160 | { |
161 | - if (! $model->isCreatable()) { |
|
161 | + if (!$model->isCreatable()) { |
|
162 | 162 | abort(404); |
163 | 163 | } |
164 | 164 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | $redirectPolicy = $model->getRedirect(); |
197 | 197 | |
198 | 198 | /* Make redirect when use in model config && Fix editable redirect */ |
199 | - if ($redirectPolicy->get('create') == 'display' || ! $model->isEditable($newModel)) { |
|
199 | + if ($redirectPolicy->get('create') == 'display' || !$model->isEditable($newModel)) { |
|
200 | 200 | $redirectUrl = $model->getDisplayUrl(); |
201 | 201 | } |
202 | 202 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | { |
236 | 236 | $item = $model->getRepository()->find($id); |
237 | 237 | |
238 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
238 | + if (is_null($item) || !$model->isEditable($item)) { |
|
239 | 239 | abort(404); |
240 | 240 | } |
241 | 241 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | $editForm = $model->fireEdit($id); |
264 | 264 | $item = $editForm->getModel(); |
265 | 265 | |
266 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
266 | + if (is_null($item) || !$model->isEditable($item)) { |
|
267 | 267 | abort(404); |
268 | 268 | } |
269 | 269 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | |
343 | 343 | /* @var ColumnEditableInterface|null $column */ |
344 | 344 | if (is_callable([$display, 'getColumns'])) { |
345 | - $column = $display->getColumns()->all()->filter(function ($column) use ($field) { |
|
345 | + $column = $display->getColumns()->all()->filter(function($column) use ($field) { |
|
346 | 346 | return ($column instanceof ColumnEditableInterface) && $field == $column->getName(); |
347 | 347 | })->first(); |
348 | 348 | } else { |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | $content = $tab->getContent(); |
352 | 352 | |
353 | 353 | if ($content instanceof DisplayTable) { |
354 | - $column = $content->getColumns()->all()->filter(function ($column) use ($field) { |
|
354 | + $column = $content->getColumns()->all()->filter(function($column) use ($field) { |
|
355 | 355 | return ($column instanceof ColumnEditableInterface) && $field == $column->getName(); |
356 | 356 | })->first(); |
357 | 357 | } |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | |
361 | 361 | //Return data-table if inside FormElements |
362 | 362 | if ($element instanceof DisplayTable) { |
363 | - $column = $element->getColumns()->all()->filter(function ($column) use ($field) { |
|
363 | + $column = $element->getColumns()->all()->filter(function($column) use ($field) { |
|
364 | 364 | return ($column instanceof ColumnEditableInterface) && $field == $column->getName(); |
365 | 365 | })->first(); |
366 | 366 | } |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | if ($element instanceof Column) { |
370 | 370 | foreach ($element->getElements() as $columnElement) { |
371 | 371 | if ($columnElement instanceof DisplayTable) { |
372 | - $column = $columnElement->getColumns()->all()->filter(function ($column) use ($field) { |
|
372 | + $column = $columnElement->getColumns()->all()->filter(function($column) use ($field) { |
|
373 | 373 | return ($column instanceof ColumnEditableInterface) && $field == $column->getName(); |
374 | 374 | })->first(); |
375 | 375 | } |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | $repository = $model->getRepository(); |
389 | 389 | $item = $repository->find($id); |
390 | 390 | |
391 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
391 | + if (is_null($item) || !$model->isEditable($item)) { |
|
392 | 392 | abort(404); |
393 | 393 | } |
394 | 394 | |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | { |
414 | 414 | $item = $model->getRepository()->find($id); |
415 | 415 | |
416 | - if (is_null($item) || ! $model->isDeletable($item)) { |
|
416 | + if (is_null($item) || !$model->isDeletable($item)) { |
|
417 | 417 | abort(404); |
418 | 418 | } |
419 | 419 | |
@@ -442,13 +442,13 @@ discard block |
||
442 | 442 | */ |
443 | 443 | public function deleteDestroy(ModelConfigurationInterface $model, Request $request, $id) |
444 | 444 | { |
445 | - if (! $model->isRestorableModel()) { |
|
445 | + if (!$model->isRestorableModel()) { |
|
446 | 446 | abort(404); |
447 | 447 | } |
448 | 448 | |
449 | 449 | $item = $model->getRepository()->findOnlyTrashed($id); |
450 | 450 | |
451 | - if (is_null($item) || ! $model->isRestorable($item)) { |
|
451 | + if (is_null($item) || !$model->isRestorable($item)) { |
|
452 | 452 | abort(404); |
453 | 453 | } |
454 | 454 | |
@@ -477,13 +477,13 @@ discard block |
||
477 | 477 | */ |
478 | 478 | public function postRestore(ModelConfigurationInterface $model, Request $request, $id) |
479 | 479 | { |
480 | - if (! $model->isRestorableModel()) { |
|
480 | + if (!$model->isRestorableModel()) { |
|
481 | 481 | abort(404); |
482 | 482 | } |
483 | 483 | |
484 | 484 | $item = $model->getRepository()->findOnlyTrashed($id); |
485 | 485 | |
486 | - if (is_null($item) || ! $model->isRestorable($item)) { |
|
486 | + if (is_null($item) || !$model->isRestorable($item)) { |
|
487 | 487 | abort(404); |
488 | 488 | } |
489 | 489 | |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | */ |
569 | 569 | protected function registerBreadcrumb($title, $parent) |
570 | 570 | { |
571 | - $this->breadcrumbs->register('render', function (Generator $breadcrumbs) use ($title, $parent) { |
|
571 | + $this->breadcrumbs->register('render', function(Generator $breadcrumbs) use ($title, $parent) { |
|
572 | 572 | $breadcrumbs->parent($parent); |
573 | 573 | $breadcrumbs->push($title); |
574 | 574 | }); |
@@ -584,8 +584,8 @@ discard block |
||
584 | 584 | $this->breadCrumbsData = $this->breadCrumbsData + (array) $model->getBreadCrumbs(); |
585 | 585 | |
586 | 586 | foreach ($this->breadCrumbsData as $breadcrumb) { |
587 | - if (! $this->breadcrumbs->exists($breadcrumb['id'])) { |
|
588 | - $this->breadcrumbs->register($breadcrumb['id'], function (Generator $breadcrumbs) use ($breadcrumb) { |
|
587 | + if (!$this->breadcrumbs->exists($breadcrumb['id'])) { |
|
588 | + $this->breadcrumbs->register($breadcrumb['id'], function(Generator $breadcrumbs) use ($breadcrumb) { |
|
589 | 589 | $breadcrumbs->parent($breadcrumb['parent']); |
590 | 590 | $breadcrumbs->push($breadcrumb['title'], $breadcrumb['url']); |
591 | 591 | }); |
@@ -40,7 +40,7 @@ |
||
40 | 40 | return false; |
41 | 41 | } |
42 | 42 | |
43 | - $this->show = ! $this->isTrashed() && $this->getModelConfiguration()->isDeletable($this->getModel()); |
|
43 | + $this->show = !$this->isTrashed() && $this->getModelConfiguration()->isDeletable($this->getModel()); |
|
44 | 44 | |
45 | 45 | return parent::canShow(); |
46 | 46 | } |
@@ -36,7 +36,7 @@ |
||
36 | 36 | */ |
37 | 37 | public function canShow() |
38 | 38 | { |
39 | - if (is_null($this->getModel()->getKey()) || ! $this->show) { |
|
39 | + if (is_null($this->getModel()->getKey()) || !$this->show) { |
|
40 | 40 | return false; |
41 | 41 | } |
42 | 42 |
@@ -100,11 +100,11 @@ discard block |
||
100 | 100 | |
101 | 101 | parent::initialize(); |
102 | 102 | |
103 | - if (! $this->hasHtmlAttribute('enctype')) { |
|
103 | + if (!$this->hasHtmlAttribute('enctype')) { |
|
104 | 104 | // Try to find upload element |
105 | - $this->getElements()->each(function ($element) { |
|
105 | + $this->getElements()->each(function($element) { |
|
106 | 106 | // Try to get nested - will be implemented |
107 | - if ($element instanceof Upload && ! $this->hasHtmlAttribute('enctype')) { |
|
107 | + if ($element instanceof Upload && !$this->hasHtmlAttribute('enctype')) { |
|
108 | 108 | $this->setHtmlAttribute('enctype', 'multipart/form-data'); |
109 | 109 | } |
110 | 110 | }); |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | */ |
210 | 210 | public function setItems($items) |
211 | 211 | { |
212 | - if (! is_array($items)) { |
|
212 | + if (!is_array($items)) { |
|
213 | 213 | $items = func_get_args(); |
214 | 214 | } |
215 | 215 | |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | */ |
237 | 237 | public function setId($id) |
238 | 238 | { |
239 | - if (is_null($this->id) && ! is_null($id) && ($model = $this->getRepository()->find($id))) { |
|
239 | + if (is_null($this->id) && !is_null($id) && ($model = $this->getRepository()->find($id))) { |
|
240 | 240 | $this->id = $id; |
241 | 241 | |
242 | 242 | parent::setModel($model); |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | */ |
298 | 298 | public function saveForm(\Illuminate\Http\Request $request, ModelConfigurationInterface $modelConfiguration = null) |
299 | 299 | { |
300 | - if (! $this->validModelConfiguration($modelConfiguration)) { |
|
300 | + if (!$this->validModelConfiguration($modelConfiguration)) { |
|
301 | 301 | return false; |
302 | 302 | } |
303 | 303 | |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | protected function saveBelongsToRelations(Model $model) |
338 | 338 | { |
339 | 339 | foreach ($model->getRelations() as $name => $relation) { |
340 | - if ($model->{$name}() instanceof BelongsTo && ! is_null($relation)) { |
|
340 | + if ($model->{$name}() instanceof BelongsTo && !is_null($relation)) { |
|
341 | 341 | $relation->save(); |
342 | 342 | $model->{$name}()->associate($relation); |
343 | 343 | } |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | protected function saveHasOneRelations(Model $model) |
353 | 353 | { |
354 | 354 | foreach ($model->getRelations() as $name => $relation) { |
355 | - if ($model->{$name}() instanceof HasOneOrMany && ! is_null($relation)) { |
|
355 | + if ($model->{$name}() instanceof HasOneOrMany && !is_null($relation)) { |
|
356 | 356 | if (is_array($relation) || $relation instanceof \Traversable) { |
357 | 357 | $model->{$name}()->saveMany($relation); |
358 | 358 | } else { |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | */ |
371 | 371 | public function validateForm(\Illuminate\Http\Request $request, ModelConfigurationInterface $modelConfiguration = null) |
372 | 372 | { |
373 | - if (! $this->validModelConfiguration($modelConfiguration)) { |
|
373 | + if (!$this->validModelConfiguration($modelConfiguration)) { |
|
374 | 374 | return; |
375 | 375 | } |
376 | 376 |