@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | $model = $this->app->make($this->getModelClassName()); |
| 90 | 90 | |
| 91 | - if (! $model instanceof Model) { |
|
| 91 | + if (!$model instanceof Model) { |
|
| 92 | 92 | throw new RepositoryException( |
| 93 | 93 | "Class {$this->getModelClassName()} must be an instance of " . Model::class |
| 94 | 94 | ); |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * |
| 158 | 158 | * @return EloquentBuilder[]|\Illuminate\Database\Eloquent\Collection|Model[]|mixed |
| 159 | 159 | */ |
| 160 | - public function all($columns = ['*']) |
|
| 160 | + public function all($columns = [ '*' ]) |
|
| 161 | 161 | { |
| 162 | 162 | $this->applyCriteria() |
| 163 | 163 | ->applyScope(); |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | * |
| 184 | 184 | * @return EloquentBuilder[]|\Illuminate\Database\Eloquent\Collection|Model[]|mixed |
| 185 | 185 | */ |
| 186 | - public function get($columns = ['*']) |
|
| 186 | + public function get($columns = [ '*' ]) |
|
| 187 | 187 | { |
| 188 | 188 | return $this->all($columns); |
| 189 | 189 | } |
@@ -198,9 +198,9 @@ discard block |
||
| 198 | 198 | * |
| 199 | 199 | * @return mixed |
| 200 | 200 | */ |
| 201 | - public function paginate(int $perPage = null, $columns = ['*']) |
|
| 201 | + public function paginate(int $perPage = null, $columns = [ '*' ]) |
|
| 202 | 202 | { |
| 203 | - return $this->getPaginator($perPage, $columns, function ($perPage, $columns) { |
|
| 203 | + return $this->getPaginator($perPage, $columns, function($perPage, $columns) { |
|
| 204 | 204 | return $this->model |
| 205 | 205 | ->paginate($perPage, $columns) |
| 206 | 206 | ->appends(app('request')->query()); |
@@ -215,9 +215,9 @@ discard block |
||
| 215 | 215 | * |
| 216 | 216 | * @return mixed |
| 217 | 217 | */ |
| 218 | - public function simplePaginate(int $perPage = null, $columns = ['*']) |
|
| 218 | + public function simplePaginate(int $perPage = null, $columns = [ '*' ]) |
|
| 219 | 219 | { |
| 220 | - return $this->getPaginator($perPage, $columns, function ($perPage, $columns) { |
|
| 220 | + return $this->getPaginator($perPage, $columns, function($perPage, $columns) { |
|
| 221 | 221 | return $this->model |
| 222 | 222 | ->simplePaginate($perPage, $columns) |
| 223 | 223 | ->appends(app('request')->query()); |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * |
| 234 | 234 | * @return mixed |
| 235 | 235 | */ |
| 236 | - protected function getPaginator(int $perPage = null, $columns = ['*'], callable $callback = null) |
|
| 236 | + protected function getPaginator(int $perPage = null, $columns = [ '*' ], callable $callback = null) |
|
| 237 | 237 | { |
| 238 | 238 | $this->applyCriteria() |
| 239 | 239 | ->applyScope(); |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * |
| 257 | 257 | * @return mixed |
| 258 | 258 | */ |
| 259 | - public function find($id, $columns = ['*']) |
|
| 259 | + public function find($id, $columns = [ '*' ]) |
|
| 260 | 260 | { |
| 261 | 261 | $this->applyCriteria() |
| 262 | 262 | ->applyScope(); |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | * |
| 278 | 278 | * @return mixed |
| 279 | 279 | */ |
| 280 | - public function findByField($field, $value = null, $columns = ['*']) |
|
| 280 | + public function findByField($field, $value = null, $columns = [ '*' ]) |
|
| 281 | 281 | { |
| 282 | 282 | $this->applyCriteria() |
| 283 | 283 | ->applyScope(); |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | * |
| 301 | 301 | * @return int |
| 302 | 302 | */ |
| 303 | - public function count($columns = ['*']): int |
|
| 303 | + public function count($columns = [ '*' ]): int |
|
| 304 | 304 | { |
| 305 | 305 | $this->applyCriteria() |
| 306 | 306 | ->applyScope(); |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | * |
| 322 | 322 | * @return mixed |
| 323 | 323 | */ |
| 324 | - public function first($columns = ['*']): ?Model |
|
| 324 | + public function first($columns = [ '*' ]): ?Model |
|
| 325 | 325 | { |
| 326 | 326 | $this->applyCriteria() |
| 327 | 327 | ->applyScope(); |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | * |
| 341 | 341 | * @return Model|null |
| 342 | 342 | */ |
| 343 | - public function create(array $attributes = []): ?Model |
|
| 343 | + public function create(array $attributes = [ ]): ?Model |
|
| 344 | 344 | { |
| 345 | 345 | $model = $this->model->create($attributes); |
| 346 | 346 | $this->clearModel(); |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | { |
| 362 | 362 | $this->applyScope(); |
| 363 | 363 | |
| 364 | - if (! $model instanceof Model) { |
|
| 364 | + if (!$model instanceof Model) { |
|
| 365 | 365 | $model = $this->model->findOrFail($model); |
| 366 | 366 | } |
| 367 | 367 | |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | { |
| 384 | 384 | $this->applyScope(); |
| 385 | 385 | |
| 386 | - if (! $model instanceof Model) { |
|
| 386 | + if (!$model instanceof Model) { |
|
| 387 | 387 | $model = $this->find($model); |
| 388 | 388 | } |
| 389 | 389 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | /** |
| 13 | 13 | * {@inheritDoc} |
| 14 | 14 | */ |
| 15 | - public function all($columns = ['*']) |
|
| 15 | + public function all($columns = [ '*' ]) |
|
| 16 | 16 | { |
| 17 | 17 | return parent::all( |
| 18 | 18 | $this->getColumnNames($columns) |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | /** |
| 23 | 23 | * {@inheritDoc} |
| 24 | 24 | */ |
| 25 | - public function paginate(int $perPage = null, $columns = ['*']) |
|
| 25 | + public function paginate(int $perPage = null, $columns = [ '*' ]) |
|
| 26 | 26 | { |
| 27 | 27 | return parent::paginate( |
| 28 | 28 | $perPage, |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | /** |
| 34 | 34 | * {@inheritDoc} |
| 35 | 35 | */ |
| 36 | - public function simplePaginate(int $perPage = null, $columns = ['*']) |
|
| 36 | + public function simplePaginate(int $perPage = null, $columns = [ '*' ]) |
|
| 37 | 37 | { |
| 38 | 38 | return parent::simplePaginate( |
| 39 | 39 | $perPage, |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | /** |
| 45 | 45 | * {@inheritDoc} |
| 46 | 46 | */ |
| 47 | - public function find($id, $columns = ['*']) |
|
| 47 | + public function find($id, $columns = [ '*' ]) |
|
| 48 | 48 | { |
| 49 | 49 | return parent::find( |
| 50 | 50 | $id, |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | /** |
| 56 | 56 | * {@inheritDoc} |
| 57 | 57 | */ |
| 58 | - public function findByField($field, $value = null, $columns = ['*']) |
|
| 58 | + public function findByField($field, $value = null, $columns = [ '*' ]) |
|
| 59 | 59 | { |
| 60 | 60 | return parent::findByField( |
| 61 | 61 | $this->getColumnName($field), |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | /** |
| 68 | 68 | * {@inheritDoc} |
| 69 | 69 | */ |
| 70 | - public function first($columns = ['*']): ?Model |
|
| 70 | + public function first($columns = [ '*' ]): ?Model |
|
| 71 | 71 | { |
| 72 | 72 | return parent::first( |
| 73 | 73 | $this->getColumnNames($columns) |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | { |
| 85 | 85 | $model = $model ?? $this->model; |
| 86 | 86 | |
| 87 | - return ! strpos($column, '.') |
|
| 87 | + return !strpos($column, '.') |
|
| 88 | 88 | ? $this->getSchemaName($model) . '.' . $column |
| 89 | 89 | : $column; |
| 90 | 90 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function popCriteria($criteria): self |
| 84 | 84 | { |
| 85 | - $this->criteria = $this->criteria->reject(function ($value) use ($criteria) { |
|
| 85 | + $this->criteria = $this->criteria->reject(function($value) use ($criteria) { |
|
| 86 | 86 | if (is_object($value) && is_string($criteria)) { |
| 87 | 87 | return get_class($value) === $criteria; |
| 88 | 88 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | $criteria = $this->getCriteria(); |
| 112 | 112 | |
| 113 | - if (! $criteria) { |
|
| 113 | + if (!$criteria) { |
|
| 114 | 114 | return $this; |
| 115 | 115 | } |
| 116 | 116 | |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | public function getWith(): array |
| 17 | 17 | { |
| 18 | - return $this->getPreloadables()['with'] ?? []; |
|
| 18 | + return $this->getPreloadables()[ 'with' ] ?? [ ]; |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | /** |
@@ -23,6 +23,6 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function getWithCount(): array |
| 25 | 25 | { |
| 26 | - return $this->getPreloadables()['withCount'] ?? []; |
|
| 26 | + return $this->getPreloadables()[ 'withCount' ] ?? [ ]; |
|
| 27 | 27 | } |
| 28 | 28 | } |