@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | * |
| 247 | 247 | * @param Request $request |
| 248 | 248 | * |
| 249 | - * @return bool |
|
| 249 | + * @return boolean|null |
|
| 250 | 250 | */ |
| 251 | 251 | public function inlineEdit(ModelConfigurationInterface $model, Request $request) |
| 252 | 252 | { |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | /** |
| 348 | - * @param ModelConfigurationInterface|ModelConfiguration $model |
|
| 348 | + * @param ModelConfigurationInterface $model |
|
| 349 | 349 | * @param Request $request |
| 350 | 350 | * @param int $id |
| 351 | 351 | * |
@@ -39,34 +39,34 @@ discard block |
||
| 39 | 39 | public function __construct(Request $request, \Illuminate\Contracts\Foundation\Application $application) |
| 40 | 40 | { |
| 41 | 41 | $this->application = $application; |
| 42 | - $this->navigation = $application['sleeping_owl.navigation']; |
|
| 42 | + $this->navigation = $application[ 'sleeping_owl.navigation' ]; |
|
| 43 | 43 | $this->navigation->setCurrentUrl($request->url()); |
| 44 | 44 | |
| 45 | - if (! Breadcrumbs::exists('home')) { |
|
| 46 | - Breadcrumbs::register('home', function ($breadcrumbs) { |
|
| 45 | + if (!Breadcrumbs::exists('home')) { |
|
| 46 | + Breadcrumbs::register('home', function($breadcrumbs) { |
|
| 47 | 47 | $breadcrumbs->push(trans('sleeping_owl::lang.dashboard'), route('admin.dashboard')); |
| 48 | 48 | }); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - $breadcrumbs = []; |
|
| 51 | + $breadcrumbs = [ ]; |
|
| 52 | 52 | |
| 53 | 53 | if ($currentPage = $this->navigation->getCurrentPage()) { |
| 54 | 54 | foreach ($currentPage->getPathArray() as $page) { |
| 55 | - $breadcrumbs[] = [ |
|
| 56 | - 'id' => $page['id'], |
|
| 57 | - 'title' => $page['title'], |
|
| 58 | - 'url' => $page['url'], |
|
| 55 | + $breadcrumbs[ ] = [ |
|
| 56 | + 'id' => $page[ 'id' ], |
|
| 57 | + 'title' => $page[ 'title' ], |
|
| 58 | + 'url' => $page[ 'url' ], |
|
| 59 | 59 | 'parent' => $this->parentBreadcrumb, |
| 60 | 60 | ]; |
| 61 | 61 | |
| 62 | - $this->parentBreadcrumb = $page['id']; |
|
| 62 | + $this->parentBreadcrumb = $page[ 'id' ]; |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | foreach ($breadcrumbs as $breadcrumb) { |
| 67 | - Breadcrumbs::register($breadcrumb['id'], function ($breadcrumbs) use ($breadcrumb) { |
|
| 68 | - $breadcrumbs->parent($breadcrumb['parent']); |
|
| 69 | - $breadcrumbs->push($breadcrumb['title'], $breadcrumb['url']); |
|
| 67 | + Breadcrumbs::register($breadcrumb[ 'id' ], function($breadcrumbs) use ($breadcrumb) { |
|
| 68 | + $breadcrumbs->parent($breadcrumb[ 'parent' ]); |
|
| 69 | + $breadcrumbs->push($breadcrumb[ 'title' ], $breadcrumb[ 'url' ]); |
|
| 70 | 70 | }); |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function getDisplay(ModelConfigurationInterface $model) |
| 96 | 96 | { |
| 97 | - if (! $model->isDisplayable()) { |
|
| 97 | + if (!$model->isDisplayable()) { |
|
| 98 | 98 | abort(404); |
| 99 | 99 | } |
| 100 | 100 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | */ |
| 109 | 109 | public function getCreate(ModelConfigurationInterface $model) |
| 110 | 110 | { |
| 111 | - if (! $model->isCreatable()) { |
|
| 111 | + if (!$model->isCreatable()) { |
|
| 112 | 112 | abort(404); |
| 113 | 113 | } |
| 114 | 114 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | public function postStore(ModelConfigurationInterface $model, Request $request) |
| 128 | 128 | { |
| 129 | - if (! $model->isCreatable()) { |
|
| 129 | + if (!$model->isCreatable()) { |
|
| 130 | 130 | abort(404); |
| 131 | 131 | } |
| 132 | 132 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | { |
| 183 | 183 | $item = $model->getRepository()->find($id); |
| 184 | 184 | |
| 185 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
| 185 | + if (is_null($item) || !$model->isEditable($item)) { |
|
| 186 | 186 | abort(404); |
| 187 | 187 | } |
| 188 | 188 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | $editForm = $model->fireEdit($id); |
| 205 | 205 | $item = $editForm->getModel(); |
| 206 | 206 | |
| 207 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
| 207 | + if (is_null($item) || !$model->isEditable($item)) { |
|
| 208 | 208 | abort(404); |
| 209 | 209 | } |
| 210 | 210 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | $display = $model->fireDisplay(); |
| 258 | 258 | |
| 259 | 259 | /** @var ColumnEditableInterface|null $column */ |
| 260 | - $column = $display->getColumns()->all()->filter(function ($column) use ($field) { |
|
| 260 | + $column = $display->getColumns()->all()->filter(function($column) use ($field) { |
|
| 261 | 261 | return ($column instanceof ColumnEditableInterface) and $field == $column->getName(); |
| 262 | 262 | })->first(); |
| 263 | 263 | |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | $repository = $model->getRepository(); |
| 269 | 269 | $item = $repository->find($id); |
| 270 | 270 | |
| 271 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
| 271 | + if (is_null($item) || !$model->isEditable($item)) { |
|
| 272 | 272 | abort(404); |
| 273 | 273 | } |
| 274 | 274 | |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | { |
| 294 | 294 | $item = $model->getRepository()->find($id); |
| 295 | 295 | |
| 296 | - if (is_null($item) || ! $model->isDeletable($item)) { |
|
| 296 | + if (is_null($item) || !$model->isDeletable($item)) { |
|
| 297 | 297 | abort(404); |
| 298 | 298 | } |
| 299 | 299 | |
@@ -320,13 +320,13 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | public function deleteDestroy(ModelConfigurationInterface $model, Request $request, $id) |
| 322 | 322 | { |
| 323 | - if (! $model->isRestorableModel()) { |
|
| 323 | + if (!$model->isRestorableModel()) { |
|
| 324 | 324 | abort(404); |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | $item = $model->getRepository()->findOnlyTrashed($id); |
| 328 | 328 | |
| 329 | - if (is_null($item) || ! $model->isRestorable($item)) { |
|
| 329 | + if (is_null($item) || !$model->isRestorable($item)) { |
|
| 330 | 330 | abort(404); |
| 331 | 331 | } |
| 332 | 332 | |
@@ -353,13 +353,13 @@ discard block |
||
| 353 | 353 | */ |
| 354 | 354 | public function postRestore(ModelConfigurationInterface $model, Request $request, $id) |
| 355 | 355 | { |
| 356 | - if (! $model->isRestorableModel()) { |
|
| 356 | + if (!$model->isRestorableModel()) { |
|
| 357 | 357 | abort(404); |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | $item = $model->getRepository()->findOnlyTrashed($id); |
| 361 | 361 | |
| 362 | - if (is_null($item) || ! $model->isRestorable($item)) { |
|
| 362 | + if (is_null($item) || !$model->isRestorable($item)) { |
|
| 363 | 363 | abort(404); |
| 364 | 364 | } |
| 365 | 365 | |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | { |
| 428 | 428 | $lang = trans('sleeping_owl::lang'); |
| 429 | 429 | if ($lang == 'sleeping_owl::lang') { |
| 430 | - $lang = trans('sleeping_owl::lang', [], 'messages', 'en'); |
|
| 430 | + $lang = trans('sleeping_owl::lang', [ ], 'messages', 'en'); |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | $data = [ |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | { |
| 471 | 471 | if (($backUrl = $request->input('_redirectBack')) == \URL::previous()) { |
| 472 | 472 | $backUrl = null; |
| 473 | - $request->merge(['_redirectBack' => $backUrl]); |
|
| 473 | + $request->merge([ '_redirectBack' => $backUrl ]); |
|
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | return $backUrl; |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | */ |
| 488 | 488 | protected function registerBreadcrumb($title, $parent) |
| 489 | 489 | { |
| 490 | - Breadcrumbs::register('render', function ($breadcrumbs) use ($title, $parent) { |
|
| 490 | + Breadcrumbs::register('render', function($breadcrumbs) use ($title, $parent) { |
|
| 491 | 491 | $breadcrumbs->parent($parent); |
| 492 | 492 | $breadcrumbs->push($title); |
| 493 | 493 | }); |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | |
| 52 | 52 | /* Workaround to allow use ServiceProvider-based configurations in old fashion */ |
| 53 | 53 | if (is_file(app_path('Providers/AdminSectionsServiceProvider.php'))) { |
| 54 | - $this->app->register($this->app->getNamespace() . 'Providers\\AdminSectionsServiceProvider'); |
|
| 54 | + $this->app->register($this->app->getNamespace().'Providers\\AdminSectionsServiceProvider'); |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
@@ -28,17 +28,17 @@ |
||
| 28 | 28 | public function fire() |
| 29 | 29 | { |
| 30 | 30 | $provider = $this->laravel->getProvider( |
| 31 | - $this->laravel->getNamespace() . 'Providers\\AdminSectionsServiceProvider' |
|
| 31 | + $this->laravel->getNamespace().'Providers\\AdminSectionsServiceProvider' |
|
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | - if (! $provider) { |
|
| 34 | + if (!$provider) { |
|
| 35 | 35 | $this->error('[App\Providers\AdminSectionsServiceProvider] not found'); |
| 36 | 36 | |
| 37 | 37 | return; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | foreach ($provider->sections() as $model => $section) { |
| 41 | - $this->callSilent('sleepingowl:section:make', ['name' => $section, 'model' => $model]); |
|
| 41 | + $this->callSilent('sleepingowl:section:make', [ 'name' => $section, 'model' => $model ]); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | $this->info('Sections generated successfully!'); |
@@ -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,14 +344,14 @@ 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 | $options = $this->getOptions(); |
| 351 | 351 | |
| 352 | 352 | if ($this->isNullable()) { |
| 353 | - $attributes['data-nullable'] = 'true'; |
|
| 354 | - $options = [null => trans('sleeping_owl::lang.select.nothing')] + $options; |
|
| 353 | + $attributes[ 'data-nullable' ] = 'true'; |
|
| 354 | + $options = [ null => trans('sleeping_owl::lang.select.nothing') ] + $options; |
|
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | $options = array_except($options, $this->exclude); |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | */ |
| 369 | 369 | protected function loadOptions() |
| 370 | 370 | { |
| 371 | - $repository = app(RepositoryInterface::class, [$this->getModelForOptions()]); |
|
| 371 | + $repository = app(RepositoryInterface::class, [ $this->getModelForOptions() ]); |
|
| 372 | 372 | |
| 373 | 373 | $key = $repository->getModel()->getKeyName(); |
| 374 | 374 | |
@@ -379,12 +379,12 @@ discard block |
||
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | if (count($this->fetchColumns) > 0) { |
| 382 | - $columns = array_merge([$key], $this->fetchColumns); |
|
| 382 | + $columns = array_merge([ $key ], $this->fetchColumns); |
|
| 383 | 383 | $options->select($columns); |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | // call the pre load options query preparer if has be set |
| 387 | - if (! is_null($preparer = $this->getLoadOptionsQueryPreparer())) { |
|
| 387 | + if (!is_null($preparer = $this->getLoadOptionsQueryPreparer())) { |
|
| 388 | 388 | $options = $preparer($this, $options); |
| 389 | 389 | } |
| 390 | 390 | |
@@ -401,9 +401,9 @@ discard block |
||
| 401 | 401 | |
| 402 | 402 | // iterate for all options and redefine it as |
| 403 | 403 | // list of KEY and TEXT pair |
| 404 | - $options = array_map(function ($opt) use ($key, $makeDisplay) { |
|
| 404 | + $options = array_map(function($opt) use ($key, $makeDisplay) { |
|
| 405 | 405 | // get the KEY and make the display text |
| 406 | - return [data_get($opt, $key), $makeDisplay($opt)]; |
|
| 406 | + return [ data_get($opt, $key), $makeDisplay($opt) ]; |
|
| 407 | 407 | }, $options); |
| 408 | 408 | |
| 409 | 409 | // take options as array with KEY => VALUE pair |
@@ -55,11 +55,11 @@ discard block |
||
| 55 | 55 | { |
| 56 | 56 | $this->content = $content; |
| 57 | 57 | |
| 58 | - if (! is_null($label)) { |
|
| 58 | + if (!is_null($label)) { |
|
| 59 | 59 | $this->setLabel($label); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if (! is_null($icon)) { |
|
| 62 | + if (!is_null($icon)) { |
|
| 63 | 63 | $this->setIcon($icon); |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | return $this->getContent()->getValidationRules(); |
| 308 | 308 | } |
| 309 | 309 | |
| 310 | - return []; |
|
| 310 | + return [ ]; |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | /** |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | return $this->getContent()->getValidationMessages(); |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | - return []; |
|
| 322 | + return [ ]; |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | /** |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | return $this->getContent()->getValidationLabels(); |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - return []; |
|
| 334 | + return [ ]; |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | /** |