@@ -30,13 +30,15 @@ |
||
| 30 | 30 | |
| 31 | 31 | public function find($id): ?Notification |
| 32 | 32 | { |
| 33 | - if ($id instanceof Notification) |
|
| 34 | - return $id; |
|
| 33 | + if ($id instanceof Notification) { |
|
| 34 | + return $id; |
|
| 35 | + } |
|
| 35 | 36 | |
| 36 | 37 | $notification = Notification::find($id); |
| 37 | 38 | |
| 38 | - if ($notification === null) |
|
| 39 | - throw new NotFoundHttpException(); |
|
| 39 | + if ($notification === null) { |
|
| 40 | + throw new NotFoundHttpException(); |
|
| 41 | + } |
|
| 40 | 42 | |
| 41 | 43 | return $notification; |
| 42 | 44 | } |
@@ -22,13 +22,15 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | public function find($id): ?User |
| 24 | 24 | { |
| 25 | - if ($id instanceof User) |
|
| 26 | - return $id; |
|
| 25 | + if ($id instanceof User) { |
|
| 26 | + return $id; |
|
| 27 | + } |
|
| 27 | 28 | |
| 28 | 29 | $user = User::find($id); |
| 29 | 30 | |
| 30 | - if ($user === null) |
|
| 31 | - throw new NotFoundHttpException(); |
|
| 31 | + if ($user === null) { |
|
| 32 | + throw new NotFoundHttpException(); |
|
| 33 | + } |
|
| 32 | 34 | |
| 33 | 35 | return $user; |
| 34 | 36 | } |
@@ -69,8 +71,9 @@ discard block |
||
| 69 | 71 | |
| 70 | 72 | public function setRoles($id, array $roles): void |
| 71 | 73 | { |
| 72 | - if (!in_array(Role::USER, $roles)) |
|
| 73 | - $roles[] = Role::USER; |
|
| 74 | + if (!in_array(Role::USER, $roles)) { |
|
| 75 | + $roles[] = Role::USER; |
|
| 76 | + } |
|
| 74 | 77 | $this->find($id)->syncRoles($roles); |
| 75 | 78 | } |
| 76 | 79 | } |
@@ -23,8 +23,9 @@ |
||
| 23 | 23 | |
| 24 | 24 | public function find($id): ?Machine |
| 25 | 25 | { |
| 26 | - if ($id instanceof Machine) |
|
| 27 | - return $id; |
|
| 26 | + if ($id instanceof Machine) { |
|
| 27 | + return $id; |
|
| 28 | + } |
|
| 28 | 29 | return Machine::find($id); |
| 29 | 30 | } |
| 30 | 31 | |
@@ -31,8 +31,9 @@ |
||
| 31 | 31 | |
| 32 | 32 | protected function getAuth0Service() |
| 33 | 33 | { |
| 34 | - if ($this->auth0 === null) |
|
| 35 | - $this->auth0 = $this->app->make(Auth0UserRepository::class); |
|
| 34 | + if ($this->auth0 === null) { |
|
| 35 | + $this->auth0 = $this->app->make(Auth0UserRepository::class); |
|
| 36 | + } |
|
| 36 | 37 | return $this->auth0; |
| 37 | 38 | } |
| 38 | 39 | |
@@ -59,8 +59,9 @@ |
||
| 59 | 59 | |
| 60 | 60 | foreach ($seeders as $seeder) { |
| 61 | 61 | $seeder = $this->laravel->make($seeder); |
| 62 | - if (!isset($seeder->seed) || $seeder->seed === false) |
|
| 63 | - $seeder->__invoke(); |
|
| 62 | + if (!isset($seeder->seed) || $seeder->seed === false) { |
|
| 63 | + $seeder->__invoke(); |
|
| 64 | + } |
|
| 64 | 65 | } |
| 65 | 66 | }); |
| 66 | 67 | |
@@ -37,8 +37,9 @@ |
||
| 37 | 37 | Artisan::call('migrate'); |
| 38 | 38 | Artisan::call('db:seed'); |
| 39 | 39 | |
| 40 | - if ($this->option('demo')) |
|
| 41 | - Artisan::call('demo:seed'); |
|
| 40 | + if ($this->option('demo')) { |
|
| 41 | + Artisan::call('demo:seed'); |
|
| 42 | + } |
|
| 42 | 43 | |
| 43 | 44 | $this->info('Database has been reset!'); |
| 44 | 45 | } |
@@ -23,8 +23,9 @@ discard block |
||
| 23 | 23 | |
| 24 | 24 | public static function cache(): ModelCacheOOP |
| 25 | 25 | { |
| 26 | - if (!isset(static::$caching)) |
|
| 27 | - static::$caching = new ModelCacheOOP(static::class, get_class_property(static::class, 'secondaryCacheIndexes'), get_class_property(static::class, 'cacheTime')); |
|
| 26 | + if (!isset(static::$caching)) { |
|
| 27 | + static::$caching = new ModelCacheOOP(static::class, get_class_property(static::class, 'secondaryCacheIndexes'), get_class_property(static::class, 'cacheTime')); |
|
| 28 | + } |
|
| 28 | 29 | return static::$caching; |
| 29 | 30 | } |
| 30 | 31 | |
@@ -57,8 +58,9 @@ discard block |
||
| 57 | 58 | |
| 58 | 59 | private static function filterFromColumns($model, $columns) |
| 59 | 60 | { |
| 60 | - if ($model === null) |
|
| 61 | - return null; |
|
| 61 | + if ($model === null) { |
|
| 62 | + return null; |
|
| 63 | + } |
|
| 62 | 64 | |
| 63 | 65 | if ($columns !== ['*']) { |
| 64 | 66 | return collect($model)->first($columns); |
@@ -41,8 +41,9 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | $model = Cache::get(self::getCacheName($id)); |
| 43 | 43 | |
| 44 | - if ($eagerLoad) |
|
| 45 | - return $this->eagerLoadRelations($model); |
|
| 44 | + if ($eagerLoad) { |
|
| 45 | + return $this->eagerLoadRelations($model); |
|
| 46 | + } |
|
| 46 | 47 | |
| 47 | 48 | return $model; |
| 48 | 49 | } |
@@ -54,15 +55,17 @@ discard block |
||
| 54 | 55 | } |
| 55 | 56 | $modelId = $this->findSecondaryIndex($index, $key); |
| 56 | 57 | |
| 57 | - if ($modelId === null) |
|
| 58 | - return ($this->model)::where($index, $key)->first(); |
|
| 58 | + if ($modelId === null) { |
|
| 59 | + return ($this->model)::where($index, $key)->first(); |
|
| 60 | + } |
|
| 59 | 61 | return $this->find($modelId, $eagerLoad); |
| 60 | 62 | } |
| 61 | 63 | |
| 62 | 64 | protected function eagerLoadRelations($model) |
| 63 | 65 | { |
| 64 | - if ($model !== null) |
|
| 65 | - return $model::eagerLoadRelations(array($model))[0]; |
|
| 66 | + if ($model !== null) { |
|
| 67 | + return $model::eagerLoadRelations(array($model))[0]; |
|
| 68 | + } |
|
| 66 | 69 | return null; |
| 67 | 70 | } |
| 68 | 71 | |
@@ -104,8 +107,9 @@ discard block |
||
| 104 | 107 | { |
| 105 | 108 | foreach ($this->secondaryIndexes as $index) { |
| 106 | 109 | $indexValue = $model->$index; |
| 107 | - if ($indexValue !== null) |
|
| 108 | - Cache::put($this->getCacheName($indexValue, $index), $model->getKey(), $this->getCacheTime()); |
|
| 110 | + if ($indexValue !== null) { |
|
| 111 | + Cache::put($this->getCacheName($indexValue, $index), $model->getKey(), $this->getCacheTime()); |
|
| 112 | + } |
|
| 109 | 113 | } |
| 110 | 114 | } |
| 111 | 115 | |