@@ -28,7 +28,7 @@ |
||
| 28 | 28 | } else { |
| 29 | 29 | $publishPath = base_path('config/repositories.php'); |
| 30 | 30 | } |
| 31 | - $this->publishes([$configPath => $publishPath], 'config'); |
|
| 31 | + $this->publishes([ $configPath => $publishPath ], 'config'); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | /** |
@@ -17,11 +17,11 @@ discard block |
||
| 17 | 17 | * |
| 18 | 18 | * @return array |
| 19 | 19 | */ |
| 20 | - public function only($keys, array $input = []): array |
|
| 20 | + public function only($keys, array $input = [ ]): array |
|
| 21 | 21 | { |
| 22 | 22 | $keys = \is_array($keys) ? $keys : \func_get_args(); |
| 23 | 23 | |
| 24 | - $output = []; |
|
| 24 | + $output = [ ]; |
|
| 25 | 25 | |
| 26 | 26 | foreach ($keys as $key) { |
| 27 | 27 | Arr::set($output, $key, data_get($input, $key)); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @return array |
| 40 | 40 | */ |
| 41 | - public function except($keys, array $input = []): array |
|
| 41 | + public function except($keys, array $input = [ ]): array |
|
| 42 | 42 | { |
| 43 | 43 | $keys = \is_array($keys) ? $keys : \func_get_args(); |
| 44 | 44 | |
@@ -55,12 +55,12 @@ discard block |
||
| 55 | 55 | * |
| 56 | 56 | * @return bool |
| 57 | 57 | */ |
| 58 | - public function exists($key, array $input = []): bool |
|
| 58 | + public function exists($key, array $input = [ ]): bool |
|
| 59 | 59 | { |
| 60 | 60 | $keys = \is_array($key) ? $key : \func_get_args(); |
| 61 | 61 | |
| 62 | 62 | foreach ($keys as $value) { |
| 63 | - if (! Arr::has($input, $value)) { |
|
| 63 | + if (!Arr::has($input, $value)) { |
|
| 64 | 64 | return false; |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -43,12 +43,12 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | public function setOrderByParameters($orderBy): void |
| 45 | 45 | { |
| 46 | - [$column, $direction] = explode(',', $orderBy); |
|
| 46 | + [ $column, $direction ] = explode(',', $orderBy); |
|
| 47 | 47 | |
| 48 | 48 | $this->column = $column; |
| 49 | 49 | $this->direction = $direction ?? 'asc'; |
| 50 | 50 | |
| 51 | - if (! \in_array($this->direction, ['asc', 'desc'])) { |
|
| 51 | + if (!\in_array($this->direction, [ 'asc', 'desc' ])) { |
|
| 52 | 52 | $this->direction = 'asc'; |
| 53 | 53 | } |
| 54 | 54 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | return $model; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if (! preg_match($this->allowedToContain, $this->column)) { |
|
| 70 | + if (!preg_match($this->allowedToContain, $this->column)) { |
|
| 71 | 71 | throw new ValidationException('OrderBy query parameter contains illegal characters.'); |
| 72 | 72 | } |
| 73 | 73 | |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | /** |
| 15 | 15 | * @var array |
| 16 | 16 | */ |
| 17 | - protected $queryFilters = []; |
|
| 17 | + protected $queryFilters = [ ]; |
|
| 18 | 18 | |
| 19 | 19 | /** |
| 20 | 20 | * @var array |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | * |
| 20 | 20 | * @return mixed |
| 21 | 21 | */ |
| 22 | - public function all($columns = ['*']); |
|
| 22 | + public function all($columns = [ '*' ]); |
|
| 23 | 23 | |
| 24 | 24 | /** |
| 25 | 25 | * Get collection of paginated records |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * |
| 32 | 32 | * @return mixed |
| 33 | 33 | */ |
| 34 | - public function paginate(int $perPage = null, $columns = ['*']); |
|
| 34 | + public function paginate(int $perPage = null, $columns = [ '*' ]); |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * @param int|null $perPage |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * |
| 42 | 42 | * @return mixed |
| 43 | 43 | */ |
| 44 | - public function simplePaginate(int $perPage = null, $columns = ['*']); |
|
| 44 | + public function simplePaginate(int $perPage = null, $columns = [ '*' ]); |
|
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * Get single or multiple records by their primary ids |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @return mixed |
| 55 | 55 | */ |
| 56 | - public function find($id, $columns = ['*']); |
|
| 56 | + public function find($id, $columns = [ '*' ]); |
|
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * @param $field |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | * |
| 65 | 65 | * @return mixed |
| 66 | 66 | */ |
| 67 | - public function findByField($field, $value = null, $columns = ['*']); |
|
| 67 | + public function findByField($field, $value = null, $columns = [ '*' ]); |
|
| 68 | 68 | |
| 69 | 69 | /** |
| 70 | 70 | * Count results of repository |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @return int |
| 77 | 77 | */ |
| 78 | - public function count($columns = ['*']): int; |
|
| 78 | + public function count($columns = [ '*' ]): int; |
|
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | 81 | * Execute the query and get the first result. |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * |
| 87 | 87 | * @return mixed |
| 88 | 88 | */ |
| 89 | - public function first($columns = ['*']): ?Model; |
|
| 89 | + public function first($columns = [ '*' ]): ?Model; |
|
| 90 | 90 | |
| 91 | 91 | /** |
| 92 | 92 | * @param array $attributes |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | * |
| 96 | 96 | * @return Model|null |
| 97 | 97 | */ |
| 98 | - public function create(array $attributes = []): ?Model; |
|
| 98 | + public function create(array $attributes = [ ]): ?Model; |
|
| 99 | 99 | |
| 100 | 100 | /** |
| 101 | 101 | * @param mixed $model |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | { |
| 86 | 86 | $model = $this->app->make($this->getModelClassName()); |
| 87 | 87 | |
| 88 | - if (! $model instanceof Model) { |
|
| 88 | + if (!$model instanceof Model) { |
|
| 89 | 89 | throw new RepositoryException( |
| 90 | 90 | "Class {$this->getModelClassName()} must be an instance of " . Model::class |
| 91 | 91 | ); |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | * |
| 155 | 155 | * @return EloquentBuilder[]|\Illuminate\Database\Eloquent\Collection|Model[]|mixed |
| 156 | 156 | */ |
| 157 | - public function all($columns = ['*']) |
|
| 157 | + public function all($columns = [ '*' ]) |
|
| 158 | 158 | { |
| 159 | 159 | $this->applyCriteria() |
| 160 | 160 | ->applyScope(); |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * |
| 181 | 181 | * @return EloquentBuilder[]|\Illuminate\Database\Eloquent\Collection|Model[]|mixed |
| 182 | 182 | */ |
| 183 | - public function get($columns = ['*']) |
|
| 183 | + public function get($columns = [ '*' ]) |
|
| 184 | 184 | { |
| 185 | 185 | return $this->all($columns); |
| 186 | 186 | } |
@@ -195,9 +195,9 @@ discard block |
||
| 195 | 195 | * |
| 196 | 196 | * @return mixed |
| 197 | 197 | */ |
| 198 | - public function paginate(int $perPage = null, $columns = ['*']) |
|
| 198 | + public function paginate(int $perPage = null, $columns = [ '*' ]) |
|
| 199 | 199 | { |
| 200 | - return $this->getPaginator($perPage, $columns, function ($perPage, $columns) { |
|
| 200 | + return $this->getPaginator($perPage, $columns, function($perPage, $columns) { |
|
| 201 | 201 | return $this->model |
| 202 | 202 | ->paginate($perPage, $columns) |
| 203 | 203 | ->appends(app('request')->query()); |
@@ -212,9 +212,9 @@ discard block |
||
| 212 | 212 | * |
| 213 | 213 | * @return mixed |
| 214 | 214 | */ |
| 215 | - public function simplePaginate(int $perPage = null, $columns = ['*']) |
|
| 215 | + public function simplePaginate(int $perPage = null, $columns = [ '*' ]) |
|
| 216 | 216 | { |
| 217 | - return $this->getPaginator($perPage, $columns, function ($perPage, $columns) { |
|
| 217 | + return $this->getPaginator($perPage, $columns, function($perPage, $columns) { |
|
| 218 | 218 | return $this->model |
| 219 | 219 | ->simplePaginate($perPage, $columns) |
| 220 | 220 | ->appends(app('request')->query()); |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | * |
| 231 | 231 | * @return mixed |
| 232 | 232 | */ |
| 233 | - protected function getPaginator(int $perPage = null, $columns = ['*'], callable $callback = null) |
|
| 233 | + protected function getPaginator(int $perPage = null, $columns = [ '*' ], callable $callback = null) |
|
| 234 | 234 | { |
| 235 | 235 | $this->applyCriteria() |
| 236 | 236 | ->applyScope(); |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | * |
| 254 | 254 | * @return mixed |
| 255 | 255 | */ |
| 256 | - public function find($id, $columns = ['*']) |
|
| 256 | + public function find($id, $columns = [ '*' ]) |
|
| 257 | 257 | { |
| 258 | 258 | $this->applyCriteria() |
| 259 | 259 | ->applyScope(); |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | * |
| 275 | 275 | * @return mixed |
| 276 | 276 | */ |
| 277 | - public function findByField($field, $value = null, $columns = ['*']) |
|
| 277 | + public function findByField($field, $value = null, $columns = [ '*' ]) |
|
| 278 | 278 | { |
| 279 | 279 | $this->applyCriteria() |
| 280 | 280 | ->applyScope(); |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | * |
| 298 | 298 | * @return int |
| 299 | 299 | */ |
| 300 | - public function count($columns = ['*']): int |
|
| 300 | + public function count($columns = [ '*' ]): int |
|
| 301 | 301 | { |
| 302 | 302 | $this->applyCriteria() |
| 303 | 303 | ->applyScope(); |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | * |
| 319 | 319 | * @return mixed |
| 320 | 320 | */ |
| 321 | - public function first($columns = ['*']): ?Model |
|
| 321 | + public function first($columns = [ '*' ]): ?Model |
|
| 322 | 322 | { |
| 323 | 323 | $this->applyCriteria() |
| 324 | 324 | ->applyScope(); |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | * |
| 338 | 338 | * @return Model|null |
| 339 | 339 | */ |
| 340 | - public function create(array $attributes = []): ?Model |
|
| 340 | + public function create(array $attributes = [ ]): ?Model |
|
| 341 | 341 | { |
| 342 | 342 | $model = $this->model->create($attributes); |
| 343 | 343 | |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | { |
| 361 | 361 | $this->applyScope(); |
| 362 | 362 | |
| 363 | - if (! $model instanceof Model) { |
|
| 363 | + if (!$model instanceof Model) { |
|
| 364 | 364 | $model = $this->model->findOrFail($model); |
| 365 | 365 | } |
| 366 | 366 | |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | { |
| 385 | 385 | $this->applyScope(); |
| 386 | 386 | |
| 387 | - if (! $model instanceof Model) { |
|
| 387 | + if (!$model instanceof Model) { |
|
| 388 | 388 | $model = $this->find($model); |
| 389 | 389 | } |
| 390 | 390 | |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | */ |
| 30 | 30 | public function getColumnNames(array $columns, $model = null): array |
| 31 | 31 | { |
| 32 | - return array_map(function ($column) use ($model) { |
|
| 32 | + return array_map(function($column) use ($model) { |
|
| 33 | 33 | return $this->getColumnName($column, $model); |
| 34 | 34 | }, $columns); |
| 35 | 35 | } |
@@ -98,7 +98,7 @@ |
||
| 98 | 98 | |
| 99 | 99 | $criteria = $this->getCriteria(); |
| 100 | 100 | |
| 101 | - if (! $criteria) { |
|
| 101 | + if (!$criteria) { |
|
| 102 | 102 | return $this; |
| 103 | 103 | } |
| 104 | 104 | |