@@ -24,12 +24,12 @@ |
||
24 | 24 | collect([ |
25 | 25 | Installation\PublishAssets::class, |
26 | 26 | ]) |
27 | - ->map(function ($installer) { |
|
27 | + ->map(function($installer) { |
|
28 | 28 | return new $installer($this, $this->config); |
29 | 29 | }) |
30 | - ->filter(function ($installer) { |
|
31 | - return $this->option('force') ? true : ! $installer->installed(); |
|
32 | - })->each(function ($installer) { |
|
30 | + ->filter(function($installer) { |
|
31 | + return $this->option('force') ? true : !$installer->installed(); |
|
32 | + })->each(function($installer) { |
|
33 | 33 | $installer->install(); |
34 | 34 | $installer->showInfo(); |
35 | 35 | }); |
@@ -22,7 +22,7 @@ |
||
22 | 22 | @foreach ($columns as $column) |
23 | 23 | <?php |
24 | 24 | $column->setModel($model); |
25 | - if($column instanceof \SleepingOwl\Admin\Display\Column\Control) { |
|
25 | + if ($column instanceof \SleepingOwl\Admin\Display\Column\Control) { |
|
26 | 26 | $column->initialize(); |
27 | 27 | } |
28 | 28 | ?> |
@@ -65,7 +65,7 @@ |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
68 | - * @return TabInterface[]|DisplayTabsCollection |
|
68 | + * @return \SleepingOwl\Admin\Form\FormElementsCollection |
|
69 | 69 | */ |
70 | 70 | public function getTabs() |
71 | 71 | { |
@@ -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 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function validateForm(ModelConfigurationInterface $model) |
165 | 165 | { |
166 | - $this->getTabs()->each(function ($tab) use ($model) { |
|
166 | + $this->getTabs()->each(function($tab) use ($model) { |
|
167 | 167 | if ($tab instanceof FormInterface) { |
168 | 168 | $tab->validateForm($model); |
169 | 169 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | */ |
176 | 176 | public function saveForm(ModelConfigurationInterface $model) |
177 | 177 | { |
178 | - $this->getTabs()->each(function (TabInterface $tab) use ($model) { |
|
178 | + $this->getTabs()->each(function(TabInterface $tab) use ($model) { |
|
179 | 179 | if ($tab instanceof FormInterface) { |
180 | 180 | $tab->saveForm($model); |
181 | 181 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @deprecated 4.5.0 |
214 | 214 | * @see getElements() |
215 | 215 | * |
216 | - * @return Collection[] |
|
216 | + * @return FormElementsCollection |
|
217 | 217 | */ |
218 | 218 | public function getItems() |
219 | 219 | { |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | * |
302 | 302 | * @param ModelConfigurationInterface $modelConfiguration |
303 | 303 | * |
304 | - * @return bool |
|
304 | + * @return null|boolean |
|
305 | 305 | */ |
306 | 306 | public function saveForm(ModelConfigurationInterface $modelConfiguration) |
307 | 307 | { |
@@ -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 { |
@@ -12,9 +12,9 @@ discard block |
||
12 | 12 | */ |
13 | 13 | public function onlyActive() |
14 | 14 | { |
15 | - return $this->filter(function ($element) { |
|
15 | + return $this->filter(function($element) { |
|
16 | 16 | if ($element instanceof FormElementInterface) { |
17 | - return ! $element->isReadonly(); |
|
17 | + return !$element->isReadonly(); |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | return true; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function onlyVisible() |
28 | 28 | { |
29 | - return $this->filter(function ($element) { |
|
29 | + return $this->filter(function($element) { |
|
30 | 30 | if ($element instanceof FormElementInterface) { |
31 | 31 | return $element->isVisible(); |
32 | 32 | } |
@@ -13,11 +13,11 @@ discard block |
||
13 | 13 | */ |
14 | 14 | public function onlyActive() |
15 | 15 | { |
16 | - return $this->filter(function (TabInterface $tab) { |
|
16 | + return $this->filter(function(TabInterface $tab) { |
|
17 | 17 | $element = $tab->getContent(); |
18 | 18 | |
19 | 19 | if ($element instanceof FormElementInterface) { |
20 | - return ! $element->isReadonly(); |
|
20 | + return !$element->isReadonly(); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | return true; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function onlyVisible() |
31 | 31 | { |
32 | - return $this->filter(function (TabInterface $tab) { |
|
32 | + return $this->filter(function(TabInterface $tab) { |
|
33 | 33 | return $tab->isVisible(); |
34 | 34 | }); |
35 | 35 | } |
@@ -24,12 +24,12 @@ |
||
24 | 24 | collect([ |
25 | 25 | Installation\PublishAssets::class, |
26 | 26 | ]) |
27 | - ->map(function ($installer) { |
|
27 | + ->map(function($installer) { |
|
28 | 28 | return new $installer($this, $this->config); |
29 | 29 | }) |
30 | - ->filter(function ($installer) { |
|
31 | - return $this->option('force') ? true : ! $installer->installed(); |
|
32 | - })->each(function ($installer) { |
|
30 | + ->filter(function($installer) { |
|
31 | + return $this->option('force') ? true : !$installer->installed(); |
|
32 | + })->each(function($installer) { |
|
33 | 33 | $installer->install(); |
34 | 34 | $installer->showInfo(); |
35 | 35 | }); |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | * |
306 | 306 | * @param Request $request |
307 | 307 | * |
308 | - * @return bool |
|
308 | + * @return boolean|null |
|
309 | 309 | * |
310 | 310 | * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException |
311 | 311 | */ |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | } |
411 | 411 | |
412 | 412 | /** |
413 | - * @param ModelConfigurationInterface|ModelConfiguration $model |
|
413 | + * @param ModelConfigurationInterface $model |
|
414 | 414 | * @param Request $request |
415 | 415 | * @param int $id |
416 | 416 | * |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | /** |
530 | 530 | * @param Request $request |
531 | 531 | * |
532 | - * @return null|string |
|
532 | + * @return string |
|
533 | 533 | */ |
534 | 534 | protected function getBackUrl(Request $request) |
535 | 535 | { |
@@ -8,7 +8,6 @@ |
||
8 | 8 | use Illuminate\Http\Response; |
9 | 9 | use Illuminate\Routing\Controller; |
10 | 10 | use Illuminate\Contracts\Support\Renderable; |
11 | -use Illuminate\Contracts\Validation\Validator; |
|
12 | 11 | use Illuminate\Validation\ValidationException; |
13 | 12 | use SleepingOwl\Admin\Contracts\FormInterface; |
14 | 13 | use SleepingOwl\Admin\Contracts\ModelConfigurationInterface; |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | $this->navigation = $application['sleeping_owl.navigation']; |
44 | 44 | $this->navigation->setCurrentUrl($request->url()); |
45 | 45 | |
46 | - if (! Breadcrumbs::exists('home')) { |
|
47 | - Breadcrumbs::register('home', function ($breadcrumbs) { |
|
46 | + if (!Breadcrumbs::exists('home')) { |
|
47 | + Breadcrumbs::register('home', function($breadcrumbs) { |
|
48 | 48 | $breadcrumbs->push(trans('sleeping_owl::lang.dashboard'), route('admin.dashboard')); |
49 | 49 | }); |
50 | 50 | } |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | foreach ($breadcrumbs as $breadcrumb) { |
68 | - if (! Breadcrumbs::exists($breadcrumb['id'])) { |
|
69 | - Breadcrumbs::register($breadcrumb['id'], function ($breadcrumbs) use ($breadcrumb) { |
|
68 | + if (!Breadcrumbs::exists($breadcrumb['id'])) { |
|
69 | + Breadcrumbs::register($breadcrumb['id'], function($breadcrumbs) use ($breadcrumb) { |
|
70 | 70 | $breadcrumbs->parent($breadcrumb['parent']); |
71 | 71 | $breadcrumbs->push($breadcrumb['title'], $breadcrumb['url']); |
72 | 72 | }); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | */ |
111 | 111 | public function getDisplay(ModelConfigurationInterface $model) |
112 | 112 | { |
113 | - if (! $model->isDisplayable()) { |
|
113 | + if (!$model->isDisplayable()) { |
|
114 | 114 | abort(404); |
115 | 115 | } |
116 | 116 | |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | */ |
127 | 127 | public function getCreate(ModelConfigurationInterface $model) |
128 | 128 | { |
129 | - if (! $model->isCreatable()) { |
|
129 | + if (!$model->isCreatable()) { |
|
130 | 130 | abort(404); |
131 | 131 | } |
132 | 132 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | */ |
147 | 147 | public function postStore(ModelConfigurationInterface $model, Request $request) |
148 | 148 | { |
149 | - if (! $model->isCreatable()) { |
|
149 | + if (!$model->isCreatable()) { |
|
150 | 150 | abort(404); |
151 | 151 | } |
152 | 152 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | $redirectPolicy = $model->getRedirect(); |
183 | 183 | |
184 | 184 | /* Make redirect when use in model config && Fix editable redirect */ |
185 | - if ($redirectPolicy->get('create') == 'display' || ! $model->isEditable($newModel)) { |
|
185 | + if ($redirectPolicy->get('create') == 'display' || !$model->isEditable($newModel)) { |
|
186 | 186 | $redirectUrl = $model->getDisplayUrl(); |
187 | 187 | } |
188 | 188 | |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | { |
220 | 220 | $item = $model->getRepository()->find($id); |
221 | 221 | |
222 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
222 | + if (is_null($item) || !$model->isEditable($item)) { |
|
223 | 223 | abort(404); |
224 | 224 | } |
225 | 225 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $editForm = $model->fireEdit($id); |
244 | 244 | $item = $editForm->getModel(); |
245 | 245 | |
246 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
246 | + if (is_null($item) || !$model->isEditable($item)) { |
|
247 | 247 | abort(404); |
248 | 248 | } |
249 | 249 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | $display = $model->fireDisplay(); |
319 | 319 | |
320 | 320 | /** @var ColumnEditableInterface|null $column */ |
321 | - $column = $display->getColumns()->all()->filter(function ($column) use ($field) { |
|
321 | + $column = $display->getColumns()->all()->filter(function($column) use ($field) { |
|
322 | 322 | return ($column instanceof ColumnEditableInterface) and $field == $column->getName(); |
323 | 323 | })->first(); |
324 | 324 | |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | $repository = $model->getRepository(); |
330 | 330 | $item = $repository->find($id); |
331 | 331 | |
332 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
332 | + if (is_null($item) || !$model->isEditable($item)) { |
|
333 | 333 | abort(404); |
334 | 334 | } |
335 | 335 | |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | { |
357 | 357 | $item = $model->getRepository()->find($id); |
358 | 358 | |
359 | - if (is_null($item) || ! $model->isDeletable($item)) { |
|
359 | + if (is_null($item) || !$model->isDeletable($item)) { |
|
360 | 360 | abort(404); |
361 | 361 | } |
362 | 362 | |
@@ -385,13 +385,13 @@ discard block |
||
385 | 385 | */ |
386 | 386 | public function deleteDestroy(ModelConfigurationInterface $model, Request $request, $id) |
387 | 387 | { |
388 | - if (! $model->isRestorableModel()) { |
|
388 | + if (!$model->isRestorableModel()) { |
|
389 | 389 | abort(404); |
390 | 390 | } |
391 | 391 | |
392 | 392 | $item = $model->getRepository()->findOnlyTrashed($id); |
393 | 393 | |
394 | - if (is_null($item) || ! $model->isRestorable($item)) { |
|
394 | + if (is_null($item) || !$model->isRestorable($item)) { |
|
395 | 395 | abort(404); |
396 | 396 | } |
397 | 397 | |
@@ -420,13 +420,13 @@ discard block |
||
420 | 420 | */ |
421 | 421 | public function postRestore(ModelConfigurationInterface $model, Request $request, $id) |
422 | 422 | { |
423 | - if (! $model->isRestorableModel()) { |
|
423 | + if (!$model->isRestorableModel()) { |
|
424 | 424 | abort(404); |
425 | 425 | } |
426 | 426 | |
427 | 427 | $item = $model->getRepository()->findOnlyTrashed($id); |
428 | 428 | |
429 | - if (is_null($item) || ! $model->isRestorable($item)) { |
|
429 | + if (is_null($item) || !$model->isRestorable($item)) { |
|
430 | 430 | abort(404); |
431 | 431 | } |
432 | 432 | |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | */ |
553 | 553 | protected function registerBreadcrumb($title, $parent) |
554 | 554 | { |
555 | - Breadcrumbs::register('render', function ($breadcrumbs) use ($title, $parent) { |
|
555 | + Breadcrumbs::register('render', function($breadcrumbs) use ($title, $parent) { |
|
556 | 556 | $breadcrumbs->parent($parent); |
557 | 557 | $breadcrumbs->push($title); |
558 | 558 | }); |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
330 | - * @return null|string |
|
330 | + * @return boolean |
|
331 | 331 | */ |
332 | 332 | public function hasCustomControllerClass() |
333 | 333 | { |
@@ -505,7 +505,6 @@ discard block |
||
505 | 505 | * @param string $event |
506 | 506 | * @param bool $halt |
507 | 507 | * @param Model|null $model |
508 | - * @param array $args |
|
509 | 508 | * |
510 | 509 | * @return mixed |
511 | 510 | */ |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | $this->repository = app(RepositoryInterface::class, [$class]); |
112 | 112 | |
113 | - if (! $this->alias) { |
|
113 | + if (!$this->alias) { |
|
114 | 114 | $this->setDefaultAlias(); |
115 | 115 | } |
116 | 116 | } |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | */ |
300 | 300 | public function can($action, Model $model) |
301 | 301 | { |
302 | - if (! $this->checkAccess) { |
|
302 | + if (!$this->checkAccess) { |
|
303 | 303 | return true; |
304 | 304 | } |
305 | 305 | |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | */ |
332 | 332 | public function hasCustomControllerClass() |
333 | 333 | { |
334 | - return ! is_null($controller = $this->getControllerClass()) and class_exists($controller); |
|
334 | + return !is_null($controller = $this->getControllerClass()) and class_exists($controller); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | /** |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | $page->setPriority($priority); |
469 | 469 | |
470 | 470 | if ($badge) { |
471 | - if (! ($badge instanceof BadgeInterface)) { |
|
471 | + if (!($badge instanceof BadgeInterface)) { |
|
472 | 472 | $badge = new Badge($badge); |
473 | 473 | } |
474 | 474 | |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | */ |
512 | 512 | public function fireEvent($event, $halt = true, Model $model = null, ...$payload) |
513 | 513 | { |
514 | - if (! isset(self::$dispatcher)) { |
|
514 | + if (!isset(self::$dispatcher)) { |
|
515 | 515 | return true; |
516 | 516 | } |
517 | 517 |