@@ -35,7 +35,7 @@ |
||
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | - * @return array |
|
| 38 | + * @return Collection |
|
| 39 | 39 | */ |
| 40 | 40 | public function getColumns() |
| 41 | 41 | { |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | parent::initialize(); |
| 29 | 29 | |
| 30 | - $this->applyCallbackToItems(function ($item) { |
|
| 30 | + $this->applyCallbackToItems(function($item) { |
|
| 31 | 31 | if ($item instanceof Initializable) { |
| 32 | 32 | $item->initialize(); |
| 33 | 33 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | { |
| 66 | 66 | parent::setModel($model); |
| 67 | 67 | |
| 68 | - $this->applyCallbackToItems(function ($item) use ($model) { |
|
| 68 | + $this->applyCallbackToItems(function($item) use ($model) { |
|
| 69 | 69 | if ($item instanceof FormElementInterface) { |
| 70 | 70 | $item->setModel($model); |
| 71 | 71 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | */ |
| 112 | 112 | public function getValidationMessages() |
| 113 | 113 | { |
| 114 | - $messages = []; |
|
| 114 | + $messages = [ ]; |
|
| 115 | 115 | |
| 116 | 116 | foreach ($this->getColumns() as $columnItems) { |
| 117 | 117 | foreach ($columnItems as $item) { |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | */ |
| 130 | 130 | public function getValidationLabels() |
| 131 | 131 | { |
| 132 | - $labels = []; |
|
| 132 | + $labels = [ ]; |
|
| 133 | 133 | |
| 134 | 134 | foreach ($this->getColumns() as $columnItems) { |
| 135 | 135 | foreach ($columnItems as $item) { |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | { |
| 147 | 147 | parent::save(); |
| 148 | 148 | |
| 149 | - $this->applyCallbackToItems(function ($item) { |
|
| 149 | + $this->applyCallbackToItems(function($item) { |
|
| 150 | 150 | if ($item instanceof FormElementInterface) { |
| 151 | 151 | $item->save(); |
| 152 | 152 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | { |
| 158 | 158 | parent::afterSave(); |
| 159 | 159 | |
| 160 | - $this->applyCallbackToItems(function ($item) { |
|
| 160 | + $this->applyCallbackToItems(function($item) { |
|
| 161 | 161 | if ($item instanceof FormElementInterface) { |
| 162 | 162 | $item->afterSave(); |
| 163 | 163 | } |
@@ -308,7 +308,7 @@ |
||
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | /** |
| 311 | - * @return null|string |
|
| 311 | + * @return string |
|
| 312 | 312 | */ |
| 313 | 313 | public function getForeignKey() |
| 314 | 314 | { |
@@ -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,13 +344,13 @@ discard block |
||
| 344 | 344 | ]; |
| 345 | 345 | |
| 346 | 346 | if ($this->isNullable()) { |
| 347 | - $attributes['data-nullable'] = 'true'; |
|
| 347 | + $attributes[ 'data-nullable' ] = 'true'; |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | $options = $this->getOptions(); |
| 351 | 351 | |
| 352 | 352 | if ($this->isNullable()) { |
| 353 | - $options = [null => trans('sleeping_owl::lang.select.nothing')] + $options; |
|
| 353 | + $options = [ null => trans('sleeping_owl::lang.select.nothing') ] + $options; |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | $options = array_except($options, $this->exclude); |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | */ |
| 368 | 368 | protected function loadOptions() |
| 369 | 369 | { |
| 370 | - $repository = app(RepositoryInterface::class, [$this->getModelForOptions()]); |
|
| 370 | + $repository = app(RepositoryInterface::class, [ $this->getModelForOptions() ]); |
|
| 371 | 371 | |
| 372 | 372 | $key = $repository->getModel()->getKeyName(); |
| 373 | 373 | |
@@ -378,12 +378,12 @@ discard block |
||
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | if (count($this->fetchColumns) > 0) { |
| 381 | - $columns = array_merge([$key], $this->fetchColumns); |
|
| 381 | + $columns = array_merge([ $key ], $this->fetchColumns); |
|
| 382 | 382 | $options->select($columns); |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | // call the pre load options query preparer if has be set |
| 386 | - if (! is_null($preparer = $this->getLoadOptionsQueryPreparer())) { |
|
| 386 | + if (!is_null($preparer = $this->getLoadOptionsQueryPreparer())) { |
|
| 387 | 387 | $options = $preparer($this, $options); |
| 388 | 388 | } |
| 389 | 389 | |
@@ -400,9 +400,9 @@ discard block |
||
| 400 | 400 | |
| 401 | 401 | // iterate for all options and redefine it as |
| 402 | 402 | // list of KEY and TEXT pair |
| 403 | - $options = array_map(function ($opt) use ($key, $makeDisplay) { |
|
| 403 | + $options = array_map(function($opt) use ($key, $makeDisplay) { |
|
| 404 | 404 | // get the KEY and make the display text |
| 405 | - return [data_get($opt, $key), $makeDisplay($opt)]; |
|
| 405 | + return [ data_get($opt, $key), $makeDisplay($opt) ]; |
|
| 406 | 406 | }, $options); |
| 407 | 407 | |
| 408 | 408 | // take options as array with KEY => VALUE pair |
@@ -207,7 +207,7 @@ |
||
| 207 | 207 | * @deprecated 4.5.0 |
| 208 | 208 | * @see getElements() |
| 209 | 209 | * |
| 210 | - * @return Collection[] |
|
| 210 | + * @return Collection |
|
| 211 | 211 | */ |
| 212 | 212 | public function getItems() |
| 213 | 213 | { |
@@ -89,14 +89,14 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $this->initialized = true; |
| 92 | - $this->repository = app(RepositoryInterface::class, [$this->class]); |
|
| 92 | + $this->repository = app(RepositoryInterface::class, [ $this->class ]); |
|
| 93 | 93 | |
| 94 | 94 | $this->setModel(app($this->class)); |
| 95 | 95 | |
| 96 | 96 | parent::initialize(); |
| 97 | 97 | |
| 98 | - $this->getElements()->each(function ($element) { |
|
| 99 | - if ($element instanceof Upload and ! $this->hasHtmlAttribute('enctype')) { |
|
| 98 | + $this->getElements()->each(function($element) { |
|
| 99 | + if ($element instanceof Upload and !$this->hasHtmlAttribute('enctype')) { |
|
| 100 | 100 | $this->setHtmlAttribute('enctype', 'multipart/form-data'); |
| 101 | 101 | } |
| 102 | 102 | }); |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | */ |
| 225 | 225 | public function setItems($items) |
| 226 | 226 | { |
| 227 | - if (! is_array($items)) { |
|
| 227 | + if (!is_array($items)) { |
|
| 228 | 228 | $items = func_get_args(); |
| 229 | 229 | } |
| 230 | 230 | |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | */ |
| 252 | 252 | public function setId($id) |
| 253 | 253 | { |
| 254 | - if (is_null($this->id) and ! is_null($id) and ($model = $this->getRepository()->find($id))) { |
|
| 254 | + if (is_null($this->id) and !is_null($id) and ($model = $this->getRepository()->find($id))) { |
|
| 255 | 255 | $this->id = $id; |
| 256 | 256 | $this->setModel($model); |
| 257 | 257 | } |
@@ -227,7 +227,7 @@ |
||
| 227 | 227 | /** |
| 228 | 228 | * @param ModelConfigurationInterface $model |
| 229 | 229 | * |
| 230 | - * @return bool |
|
| 230 | + * @return boolean|null |
|
| 231 | 231 | */ |
| 232 | 232 | public function inlineEdit(ModelConfigurationInterface $model) |
| 233 | 233 | { |
@@ -37,29 +37,29 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | $this->navigation->setCurrentUrl($request->url()); |
| 39 | 39 | |
| 40 | - Breadcrumbs::register('home', function ($breadcrumbs) { |
|
| 40 | + Breadcrumbs::register('home', function($breadcrumbs) { |
|
| 41 | 41 | $breadcrumbs->push(trans('sleeping_owl::lang.dashboard'), route('admin.dashboard')); |
| 42 | 42 | }); |
| 43 | 43 | |
| 44 | - $breadcrumbs = []; |
|
| 44 | + $breadcrumbs = [ ]; |
|
| 45 | 45 | |
| 46 | 46 | if ($currentPage = $this->navigation->getCurrentPage()) { |
| 47 | 47 | foreach ($currentPage->getPathArray() as $page) { |
| 48 | - $breadcrumbs[] = [ |
|
| 49 | - 'id' => $page['id'], |
|
| 50 | - 'title' => $page['title'], |
|
| 51 | - 'url' => $page['url'], |
|
| 48 | + $breadcrumbs[ ] = [ |
|
| 49 | + 'id' => $page[ 'id' ], |
|
| 50 | + 'title' => $page[ 'title' ], |
|
| 51 | + 'url' => $page[ 'url' ], |
|
| 52 | 52 | 'parent' => $this->parentBreadcrumb, |
| 53 | 53 | ]; |
| 54 | 54 | |
| 55 | - $this->parentBreadcrumb = $page['id']; |
|
| 55 | + $this->parentBreadcrumb = $page[ 'id' ]; |
|
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | foreach ($breadcrumbs as $breadcrumb) { |
| 60 | - Breadcrumbs::register($breadcrumb['id'], function ($breadcrumbs) use ($breadcrumb) { |
|
| 61 | - $breadcrumbs->parent($breadcrumb['parent']); |
|
| 62 | - $breadcrumbs->push($breadcrumb['title'], $breadcrumb['url']); |
|
| 60 | + Breadcrumbs::register($breadcrumb[ 'id' ], function($breadcrumbs) use ($breadcrumb) { |
|
| 61 | + $breadcrumbs->parent($breadcrumb[ 'parent' ]); |
|
| 62 | + $breadcrumbs->push($breadcrumb[ 'title' ], $breadcrumb[ 'url' ]); |
|
| 63 | 63 | }); |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public function getDisplay(ModelConfigurationInterface $model) |
| 73 | 73 | { |
| 74 | - if (! $model->isDisplayable()) { |
|
| 74 | + if (!$model->isDisplayable()) { |
|
| 75 | 75 | abort(404); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function getCreate(ModelConfigurationInterface $model) |
| 87 | 87 | { |
| 88 | - if (! $model->isCreatable()) { |
|
| 88 | + if (!$model->isCreatable()) { |
|
| 89 | 89 | abort(404); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public function postStore(ModelConfigurationInterface $model) |
| 105 | 105 | { |
| 106 | - if (! $model->isCreatable()) { |
|
| 106 | + if (!$model->isCreatable()) { |
|
| 107 | 107 | abort(404); |
| 108 | 108 | } |
| 109 | 109 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | { |
| 164 | 164 | $item = $model->getRepository()->find($id); |
| 165 | 165 | |
| 166 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
| 166 | + if (is_null($item) || !$model->isEditable($item)) { |
|
| 167 | 167 | abort(404); |
| 168 | 168 | } |
| 169 | 169 | |
@@ -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 | |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | $display = $model->fireDisplay(); |
| 239 | 239 | |
| 240 | 240 | /** @var ColumnEditableInterface|null $column */ |
| 241 | - $column = $display->getColumns()->all()->filter(function ($column) use ($field) { |
|
| 241 | + $column = $display->getColumns()->all()->filter(function($column) use ($field) { |
|
| 242 | 242 | return ($column instanceof ColumnEditableInterface) and $field == $column->getName(); |
| 243 | 243 | })->first(); |
| 244 | 244 | |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | $repository = $model->getRepository(); |
| 250 | 250 | $item = $repository->find($id); |
| 251 | 251 | |
| 252 | - if (is_null($item) || ! $model->isEditable($item)) { |
|
| 252 | + if (is_null($item) || !$model->isEditable($item)) { |
|
| 253 | 253 | abort(404); |
| 254 | 254 | } |
| 255 | 255 | |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | { |
| 275 | 275 | $item = $model->getRepository()->find($id); |
| 276 | 276 | |
| 277 | - if (is_null($item) || ! $model->isDeletable($item)) { |
|
| 277 | + if (is_null($item) || !$model->isDeletable($item)) { |
|
| 278 | 278 | abort(404); |
| 279 | 279 | } |
| 280 | 280 | |
@@ -299,13 +299,13 @@ discard block |
||
| 299 | 299 | */ |
| 300 | 300 | public function deleteDestroy(ModelConfigurationInterface $model, $id) |
| 301 | 301 | { |
| 302 | - if (! $model->isRestorableModel()) { |
|
| 302 | + if (!$model->isRestorableModel()) { |
|
| 303 | 303 | abort(404); |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | 306 | $item = $model->getRepository()->findOnlyTrashed($id); |
| 307 | 307 | |
| 308 | - if (is_null($item) || ! $model->isRestorable($item)) { |
|
| 308 | + if (is_null($item) || !$model->isRestorable($item)) { |
|
| 309 | 309 | abort(404); |
| 310 | 310 | } |
| 311 | 311 | |
@@ -330,13 +330,13 @@ discard block |
||
| 330 | 330 | */ |
| 331 | 331 | public function postRestore($model, $id) |
| 332 | 332 | { |
| 333 | - if (! $model->isRestorableModel()) { |
|
| 333 | + if (!$model->isRestorableModel()) { |
|
| 334 | 334 | abort(404); |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | $item = $model->getRepository()->findOnlyTrashed($id); |
| 338 | 338 | |
| 339 | - if (is_null($item) || ! $model->isRestorable($item)) { |
|
| 339 | + if (is_null($item) || !$model->isRestorable($item)) { |
|
| 340 | 340 | abort(404); |
| 341 | 341 | } |
| 342 | 342 | |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | { |
| 404 | 404 | $lang = trans('sleeping_owl::lang'); |
| 405 | 405 | if ($lang == 'sleeping_owl::lang') { |
| 406 | - $lang = trans('sleeping_owl::lang', [], 'messages', 'en'); |
|
| 406 | + $lang = trans('sleeping_owl::lang', [ ], 'messages', 'en'); |
|
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | $data = [ |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | { |
| 445 | 445 | if (($backUrl = Request::input('_redirectBack')) == \URL::previous()) { |
| 446 | 446 | $backUrl = null; |
| 447 | - Request::merge(['_redirectBack' => $backUrl]); |
|
| 447 | + Request::merge([ '_redirectBack' => $backUrl ]); |
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | return $backUrl; |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | */ |
| 462 | 462 | protected function registerBreadcrumb($title, $parent) |
| 463 | 463 | { |
| 464 | - Breadcrumbs::register('render', function ($breadcrumbs) use ($title, $parent) { |
|
| 464 | + Breadcrumbs::register('render', function($breadcrumbs) use ($title, $parent) { |
|
| 465 | 465 | $breadcrumbs->parent($parent); |
| 466 | 466 | $breadcrumbs->push($title); |
| 467 | 467 | }); |
@@ -501,7 +501,7 @@ |
||
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | /** |
| 504 | - * @param $id |
|
| 504 | + * @param integer $id |
|
| 505 | 505 | * |
| 506 | 506 | * @return mixed|void |
| 507 | 507 | */ |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | */ |
| 333 | 333 | public function isCreatable() |
| 334 | 334 | { |
| 335 | - if (! is_callable($this->getCreate())) { |
|
| 335 | + if (!is_callable($this->getCreate())) { |
|
| 336 | 336 | return false; |
| 337 | 337 | } |
| 338 | 338 | |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | */ |
| 357 | 357 | public function isEditable(Model $model) |
| 358 | 358 | { |
| 359 | - if (! is_callable($this->getEdit())) { |
|
| 359 | + if (!is_callable($this->getEdit())) { |
|
| 360 | 360 | return false; |
| 361 | 361 | } |
| 362 | 362 | |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | */ |
| 467 | 467 | public function fireDisplay() |
| 468 | 468 | { |
| 469 | - if (! is_callable($this->display)) { |
|
| 469 | + if (!is_callable($this->display)) { |
|
| 470 | 470 | return; |
| 471 | 471 | } |
| 472 | 472 | |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | */ |
| 485 | 485 | public function fireCreate() |
| 486 | 486 | { |
| 487 | - if (! is_callable($this->create)) { |
|
| 487 | + if (!is_callable($this->create)) { |
|
| 488 | 488 | return; |
| 489 | 489 | } |
| 490 | 490 | |
@@ -507,11 +507,11 @@ discard block |
||
| 507 | 507 | */ |
| 508 | 508 | public function fireEdit($id) |
| 509 | 509 | { |
| 510 | - if (! is_callable($this->edit)) { |
|
| 510 | + if (!is_callable($this->edit)) { |
|
| 511 | 511 | return; |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | - $edit = app()->call($this->edit, ['id' => $id]); |
|
| 514 | + $edit = app()->call($this->edit, [ 'id' => $id ]); |
|
| 515 | 515 | if ($edit instanceof DisplayInterface) { |
| 516 | 516 | $edit->setModelClass($this->getClass()); |
| 517 | 517 | $edit->initialize(); |
@@ -545,7 +545,7 @@ discard block |
||
| 545 | 545 | public function fireDelete($id) |
| 546 | 546 | { |
| 547 | 547 | if (is_callable($this->getDelete())) { |
| 548 | - return app()->call($this->getDelete(), [$id]); |
|
| 548 | + return app()->call($this->getDelete(), [ $id ]); |
|
| 549 | 549 | } |
| 550 | 550 | } |
| 551 | 551 | |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | public function fireDestroy($id) |
| 558 | 558 | { |
| 559 | 559 | if (is_callable($this->getDestroy())) { |
| 560 | - return app()->call($this->getDestroy(), [$id]); |
|
| 560 | + return app()->call($this->getDestroy(), [ $id ]); |
|
| 561 | 561 | } |
| 562 | 562 | } |
| 563 | 563 | |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | public function fireRestore($id) |
| 570 | 570 | { |
| 571 | 571 | if (is_callable($this->getRestore())) { |
| 572 | - return app()->call($this->getRestore(), [$id]); |
|
| 572 | + return app()->call($this->getRestore(), [ $id ]); |
|
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | return $this->getRestore(); |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |
| 282 | - * @return null|string |
|
| 282 | + * @return boolean |
|
| 283 | 283 | */ |
| 284 | 284 | public function hasCustomControllerClass() |
| 285 | 285 | { |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | /** |
| 332 | - * @param string|int $id |
|
| 332 | + * @param integer $id |
|
| 333 | 333 | * |
| 334 | 334 | * @return string |
| 335 | 335 | */ |
@@ -103,9 +103,9 @@ discard block |
||
| 103 | 103 | $this->class = $class; |
| 104 | 104 | $this->model = app($class); |
| 105 | 105 | |
| 106 | - $this->repository = app(RepositoryInterface::class, [$class]); |
|
| 106 | + $this->repository = app(RepositoryInterface::class, [ $class ]); |
|
| 107 | 107 | |
| 108 | - if (! $this->alias) { |
|
| 108 | + if (!$this->alias) { |
|
| 109 | 109 | $this->setDefaultAlias(); |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | */ |
| 181 | 181 | public function getCreateTitle() |
| 182 | 182 | { |
| 183 | - return trans('sleeping_owl::lang.model.create', ['title' => $this->getTitle()]); |
|
| 183 | + return trans('sleeping_owl::lang.model.create', [ 'title' => $this->getTitle() ]); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | /** |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | public function getEditTitle() |
| 190 | 190 | { |
| 191 | - return trans('sleeping_owl::lang.model.edit', ['title' => $this->getTitle()]); |
|
| 191 | + return trans('sleeping_owl::lang.model.edit', [ 'title' => $this->getTitle() ]); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | /** |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | */ |
| 264 | 264 | public function can($action, Model $model) |
| 265 | 265 | { |
| 266 | - if (! $this->checkAccess) { |
|
| 266 | + if (!$this->checkAccess) { |
|
| 267 | 267 | return true; |
| 268 | 268 | } |
| 269 | 269 | |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | */ |
| 284 | 284 | public function hasCustomControllerClass() |
| 285 | 285 | { |
| 286 | - return ! is_null($controller = $this->getControllerClass()) and class_exists($controller); |
|
| 286 | + return !is_null($controller = $this->getControllerClass()) and class_exists($controller); |
|
| 287 | 287 | } |
| 288 | 288 | |
| 289 | 289 | /** |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | * |
| 292 | 292 | * @return string |
| 293 | 293 | */ |
| 294 | - public function getDisplayUrl(array $parameters = []) |
|
| 294 | + public function getDisplayUrl(array $parameters = [ ]) |
|
| 295 | 295 | { |
| 296 | 296 | array_unshift($parameters, $this->getAlias()); |
| 297 | 297 | |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | * |
| 304 | 304 | * @return string |
| 305 | 305 | */ |
| 306 | - public function getCreateUrl(array $parameters = []) |
|
| 306 | + public function getCreateUrl(array $parameters = [ ]) |
|
| 307 | 307 | { |
| 308 | 308 | array_unshift($parameters, $this->getAlias()); |
| 309 | 309 | |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | */ |
| 326 | 326 | public function getEditUrl($id) |
| 327 | 327 | { |
| 328 | - return route('admin.model.edit', [$this->getAlias(), $id]); |
|
| 328 | + return route('admin.model.edit', [ $this->getAlias(), $id ]); |
|
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | /** |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | */ |
| 336 | 336 | public function getUpdateUrl($id) |
| 337 | 337 | { |
| 338 | - return route('admin.model.update', [$this->getAlias(), $id]); |
|
| 338 | + return route('admin.model.update', [ $this->getAlias(), $id ]); |
|
| 339 | 339 | } |
| 340 | 340 | |
| 341 | 341 | /** |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | */ |
| 346 | 346 | public function getDeleteUrl($id) |
| 347 | 347 | { |
| 348 | - return route('admin.model.delete', [$this->getAlias(), $id]); |
|
| 348 | + return route('admin.model.delete', [ $this->getAlias(), $id ]); |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | /** |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | */ |
| 356 | 356 | public function getDestroyUrl($id) |
| 357 | 357 | { |
| 358 | - return route('admin.model.destroy', [$this->getAlias(), $id]); |
|
| 358 | + return route('admin.model.destroy', [ $this->getAlias(), $id ]); |
|
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | /** |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | */ |
| 366 | 366 | public function getRestoreUrl($id) |
| 367 | 367 | { |
| 368 | - return route('admin.model.restore', [$this->getAlias(), $id]); |
|
| 368 | + return route('admin.model.restore', [ $this->getAlias(), $id ]); |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | /** |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | $page->setPriority($priority); |
| 421 | 421 | |
| 422 | 422 | if ($badge) { |
| 423 | - if (! ($badge instanceof BadgeInterface)) { |
|
| 423 | + if (!($badge instanceof BadgeInterface)) { |
|
| 424 | 424 | $badge = new Badge($badge); |
| 425 | 425 | } |
| 426 | 426 | |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | */ |
| 444 | 444 | public function fireEvent($event, $halt = true, Model $model = null) |
| 445 | 445 | { |
| 446 | - if (! isset(self::$dispatcher)) { |
|
| 446 | + if (!isset(self::$dispatcher)) { |
|
| 447 | 447 | return true; |
| 448 | 448 | } |
| 449 | 449 | |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | |
| 459 | 459 | $method = $halt ? 'until' : 'fire'; |
| 460 | 460 | |
| 461 | - return self::$dispatcher->$method($event, [$this, $model]); |
|
| 461 | + return self::$dispatcher->$method($event, [ $this, $model ]); |
|
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | /** |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | ])) { |
| 478 | 478 | array_unshift($arguments, $method); |
| 479 | 479 | |
| 480 | - return call_user_func_array([$this, 'registerEvent'], $arguments); |
|
| 480 | + return call_user_func_array([ $this, 'registerEvent' ], $arguments); |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | throw new BadMethodCallException($method); |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | - * @param $id |
|
| 71 | + * @param integer $id |
|
| 72 | 72 | * |
| 73 | 73 | * @return mixed|void |
| 74 | 74 | */ |
@@ -31,11 +31,11 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function fireDisplay() |
| 33 | 33 | { |
| 34 | - if (! method_exists($this, 'onDisplay')) { |
|
| 34 | + if (!method_exists($this, 'onDisplay')) { |
|
| 35 | 35 | return; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - $display = app()->call([$this, 'onDisplay']); |
|
| 38 | + $display = app()->call([ $this, 'onDisplay' ]); |
|
| 39 | 39 | |
| 40 | 40 | if ($display instanceof DisplayInterface) { |
| 41 | 41 | $display->setModelClass($this->getClass()); |
@@ -50,11 +50,11 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public function fireCreate() |
| 52 | 52 | { |
| 53 | - if (! method_exists($this, 'onCreate')) { |
|
| 53 | + if (!method_exists($this, 'onCreate')) { |
|
| 54 | 54 | return; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $create = app()->call([$this, 'onCreate']); |
|
| 57 | + $create = app()->call([ $this, 'onCreate' ]); |
|
| 58 | 58 | if ($create instanceof DisplayInterface) { |
| 59 | 59 | $create->setModelClass($this->getClass()); |
| 60 | 60 | $create->initialize(); |
@@ -74,11 +74,11 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | public function fireEdit($id) |
| 76 | 76 | { |
| 77 | - if (! method_exists($this, 'onEdit')) { |
|
| 77 | + if (!method_exists($this, 'onEdit')) { |
|
| 78 | 78 | return; |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - $edit = app()->call([$this, 'onEdit'], ['id' => $id]); |
|
| 81 | + $edit = app()->call([ $this, 'onEdit' ], [ 'id' => $id ]); |
|
| 82 | 82 | if ($edit instanceof DisplayInterface) { |
| 83 | 83 | $edit->setModelClass($this->getClass()); |
| 84 | 84 | $edit->initialize(); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | public function fireDelete($id) |
| 113 | 113 | { |
| 114 | 114 | if (method_exists($this, 'onDelete')) { |
| 115 | - return app()->call([$this, 'onDelete'], ['id' => $id]); |
|
| 115 | + return app()->call([ $this, 'onDelete' ], [ 'id' => $id ]); |
|
| 116 | 116 | } |
| 117 | 117 | } |
| 118 | 118 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | public function fireDestroy($id) |
| 125 | 125 | { |
| 126 | 126 | if (method_exists($this, 'onDestroy')) { |
| 127 | - return app()->call([$this, 'onDestroy'], ['id' => $id]); |
|
| 127 | + return app()->call([ $this, 'onDestroy' ], [ 'id' => $id ]); |
|
| 128 | 128 | } |
| 129 | 129 | } |
| 130 | 130 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | public function fireRestore($id) |
| 137 | 137 | { |
| 138 | 138 | if (method_exists($this, 'onRestore')) { |
| 139 | - return app()->call([$this, 'onRestore'], ['id' => $id]); |
|
| 139 | + return app()->call([ $this, 'onRestore' ], [ 'id' => $id ]); |
|
| 140 | 140 | } |
| 141 | 141 | } |
| 142 | 142 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | - * @return \string[] |
|
| 63 | + * @return string[] |
|
| 64 | 64 | */ |
| 65 | 65 | public function getWith() |
| 66 | 66 | { |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | 83 | * Get base query. |
| 84 | - * @return mixed |
|
| 84 | + * @return \Illuminate\Database\Eloquent\Builder |
|
| 85 | 85 | */ |
| 86 | 86 | public function getQuery() |
| 87 | 87 | { |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * Eager loading relations. |
| 26 | 26 | * @var string[] |
| 27 | 27 | */ |
| 28 | - protected $with = []; |
|
| 28 | + protected $with = [ ]; |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * @param string $class |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function with($with) |
| 74 | 74 | { |
| 75 | - if (! is_array($with)) { |
|
| 75 | + if (!is_array($with)) { |
|
| 76 | 76 | $with = func_get_args(); |
| 77 | 77 | } |
| 78 | 78 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | public function hasColumn($column) |
| 179 | 179 | { |
| 180 | 180 | $table = $this->getModel()->getTable(); |
| 181 | - $columns = Cache::remember('admin.columns.'.$table, 60, function () use ($table) { |
|
| 181 | + $columns = Cache::remember('admin.columns.'.$table, 60, function() use ($table) { |
|
| 182 | 182 | return Schema::getColumnListing($table); |
| 183 | 183 | }); |
| 184 | 184 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | * |
| 203 | 203 | * @param $id |
| 204 | 204 | * @param $parentId |
| 205 | - * @param $left |
|
| 205 | + * @param integer $left |
|
| 206 | 206 | * @param $right |
| 207 | 207 | */ |
| 208 | 208 | public function move($id, $parentId, $left, $right) |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | * Call several methods and get first result. |
| 292 | 292 | * |
| 293 | 293 | * @param $instance |
| 294 | - * @param $methods |
|
| 294 | + * @param string[] $methods |
|
| 295 | 295 | * |
| 296 | 296 | * @return mixed |
| 297 | 297 | * @throws Exception |
@@ -311,9 +311,9 @@ discard block |
||
| 311 | 311 | * |
| 312 | 312 | * @param $root |
| 313 | 313 | * @param $parentId |
| 314 | - * @param $left |
|
| 314 | + * @param integer $left |
|
| 315 | 315 | * |
| 316 | - * @return mixed |
|
| 316 | + * @return integer |
|
| 317 | 317 | */ |
| 318 | 318 | protected function recursiveReorder($root, $parentId, $left) |
| 319 | 319 | { |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | * Recursive reoder simple tree type. |
| 333 | 333 | * |
| 334 | 334 | * @param $data |
| 335 | - * @param $parentId |
|
| 335 | + * @param string|null $parentId |
|
| 336 | 336 | */ |
| 337 | 337 | protected function recursiveReorderSimple($data, $parentId) |
| 338 | 338 | { |
@@ -354,9 +354,9 @@ discard block |
||
| 354 | 354 | * Get children for simple tree type structure. |
| 355 | 355 | * |
| 356 | 356 | * @param $collection |
| 357 | - * @param $id |
|
| 357 | + * @param string|null $id |
|
| 358 | 358 | * |
| 359 | - * @return static |
|
| 359 | + * @return Collection |
|
| 360 | 360 | */ |
| 361 | 361 | protected function getChildren($collection, $id) |
| 362 | 362 | { |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | |
| 377 | 377 | /** |
| 378 | 378 | * Create simple tree type structure. |
| 379 | - * @return static |
|
| 379 | + * @return Collection |
|
| 380 | 380 | */ |
| 381 | 381 | protected function createSimpleTree() |
| 382 | 382 | { |
@@ -381,9 +381,9 @@ |
||
| 381 | 381 | protected function createSimpleTree() |
| 382 | 382 | { |
| 383 | 383 | $collection = $this->getQuery() |
| 384 | - ->orderBy($this->getParentField(), 'asc') |
|
| 385 | - ->orderBy($this->getOrderField(), 'asc') |
|
| 386 | - ->get(); |
|
| 384 | + ->orderBy($this->getParentField(), 'asc') |
|
| 385 | + ->orderBy($this->getOrderField(), 'asc') |
|
| 386 | + ->get(); |
|
| 387 | 387 | |
| 388 | 388 | $parent = $this->getRootParentId(); |
| 389 | 389 | |
@@ -209,9 +209,9 @@ discard block |
||
| 209 | 209 | { |
| 210 | 210 | $instance = $this->find($id); |
| 211 | 211 | $attributes = $instance->getAttributes(); |
| 212 | - $attributes[$this->getLeftColumn($instance)] = $left; |
|
| 213 | - $attributes[$this->getRightColumn($instance)] = $right; |
|
| 214 | - $attributes[$this->getParentColumn($instance)] = $parentId; |
|
| 212 | + $attributes[ $this->getLeftColumn($instance) ] = $left; |
|
| 213 | + $attributes[ $this->getRightColumn($instance) ] = $right; |
|
| 214 | + $attributes[ $this->getParentColumn($instance) ] = $parentId; |
|
| 215 | 215 | $instance->setRawAttributes($attributes); |
| 216 | 216 | $instance->save(); |
| 217 | 217 | } |
@@ -318,11 +318,11 @@ discard block |
||
| 318 | 318 | protected function recursiveReorder($root, $parentId, $left) |
| 319 | 319 | { |
| 320 | 320 | $right = $left + 1; |
| 321 | - $children = array_get($root, 'children', []); |
|
| 321 | + $children = array_get($root, 'children', [ ]); |
|
| 322 | 322 | foreach ($children as $child) { |
| 323 | - $right = $this->recursiveReorder($child, $root['id'], $right); |
|
| 323 | + $right = $this->recursiveReorder($child, $root[ 'id' ], $right); |
|
| 324 | 324 | } |
| 325 | - $this->move($root['id'], $parentId, $left, $right); |
|
| 325 | + $this->move($root[ 'id' ], $parentId, $left, $right); |
|
| 326 | 326 | $left = $right + 1; |
| 327 | 327 | |
| 328 | 328 | return $left; |
@@ -337,15 +337,15 @@ discard block |
||
| 337 | 337 | protected function recursiveReorderSimple($data, $parentId) |
| 338 | 338 | { |
| 339 | 339 | foreach ($data as $order => $item) { |
| 340 | - $id = $item['id']; |
|
| 340 | + $id = $item[ 'id' ]; |
|
| 341 | 341 | |
| 342 | 342 | $instance = $this->find($id); |
| 343 | 343 | $instance->{$this->getParentField()} = $parentId; |
| 344 | 344 | $instance->{$this->getOrderField()} = $order; |
| 345 | 345 | $instance->save(); |
| 346 | 346 | |
| 347 | - if (isset($item['children'])) { |
|
| 348 | - $this->recursiveReorderSimple($item['children'], $id); |
|
| 347 | + if (isset($item[ 'children' ])) { |
|
| 348 | + $this->recursiveReorderSimple($item[ 'children' ], $id); |
|
| 349 | 349 | } |
| 350 | 350 | } |
| 351 | 351 | } |
@@ -361,14 +361,14 @@ discard block |
||
| 361 | 361 | protected function getChildren($collection, $id) |
| 362 | 362 | { |
| 363 | 363 | $parentField = $this->getParentField(); |
| 364 | - $result = []; |
|
| 364 | + $result = [ ]; |
|
| 365 | 365 | foreach ($collection as $instance) { |
| 366 | 366 | if ($instance->$parentField != $id) { |
| 367 | 367 | continue; |
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | $instance->setRelation('children', $this->getChildren($collection, $instance->getKey())); |
| 371 | - $result[] = $instance; |
|
| 371 | + $result[ ] = $instance; |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | return Collection::make($result); |