@@ -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 | /** |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * @var array |
| 52 | 52 | */ |
| 53 | - protected $with = []; |
|
| 53 | + protected $with = [ ]; |
|
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * @var string |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $this->repository = $this->makeRepository(); |
| 168 | 168 | $this->repository->with($this->with); |
| 169 | 169 | |
| 170 | - $this->extensions->each(function (DisplayExtensionInterface $extension) { |
|
| 170 | + $this->extensions->each(function(DisplayExtensionInterface $extension) { |
|
| 171 | 171 | if ($extension instanceof Initializable) { |
| 172 | 172 | $extension->initialize(); |
| 173 | 173 | } |
@@ -201,9 +201,9 @@ discard block |
||
| 201 | 201 | $this->title, |
| 202 | 202 | ]; |
| 203 | 203 | |
| 204 | - $this->getExtensions()->each(function (DisplayExtensionInterface $extension) use (&$titles) { |
|
| 204 | + $this->getExtensions()->each(function(DisplayExtensionInterface $extension) use (&$titles) { |
|
| 205 | 205 | if (method_exists($extension, $method = 'getTitle')) { |
| 206 | - $titles[] = call_user_func([$extension, $method]); |
|
| 206 | + $titles[ ] = call_user_func([ $extension, $method ]); |
|
| 207 | 207 | } |
| 208 | 208 | }); |
| 209 | 209 | |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | })->each(function($extension) use($view) { |
| 271 | 271 | $html = app('sleeping_owl.template')->view($extension->getView(), $extension->toArray())->render(); |
| 272 | 272 | |
| 273 | - if (! empty($html)) { |
|
| 273 | + if (!empty($html)) { |
|
| 274 | 274 | $factory = $view->getFactory(); |
| 275 | 275 | |
| 276 | 276 | $factory->startSection($extension->getPlacement()); |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | $extension = $this->extensions->get($method); |
| 307 | 307 | |
| 308 | 308 | if (method_exists($extension, 'set')) { |
| 309 | - return call_user_func_array([$extension, 'set'], $arguments); |
|
| 309 | + return call_user_func_array([ $extension, 'set' ], $arguments); |
|
| 310 | 310 | } |
| 311 | 311 | } |
| 312 | 312 | |
@@ -327,9 +327,9 @@ discard block |
||
| 327 | 327 | */ |
| 328 | 328 | protected function makeRepository() |
| 329 | 329 | { |
| 330 | - $repository = app($this->repositoryClass, [$this->modelClass]); |
|
| 330 | + $repository = app($this->repositoryClass, [ $this->modelClass ]); |
|
| 331 | 331 | |
| 332 | - if (! ($repository instanceof RepositoryInterface)) { |
|
| 332 | + if (!($repository instanceof RepositoryInterface)) { |
|
| 333 | 333 | throw new \Exception('Repository class must be instanced of [RepositoryInterface]'); |
| 334 | 334 | } |
| 335 | 335 | |