@@ -11,6 +11,6 @@ |
||
11 | 11 | | |
12 | 12 | */ |
13 | 13 | |
14 | -Broadcast::channel('user.{id}', function ($user, $id) { |
|
14 | +Broadcast::channel('user.{id}', function($user, $id) { |
|
15 | 15 | return $user->id === (int) $id; |
16 | 16 | }); |
@@ -56,32 +56,32 @@ |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | if ($unwrap) { |
59 | - return json_decode($content, true)['data'] ?? json_decode($content, true); |
|
59 | + return json_decode($content, true)[ 'data' ] ?? json_decode($content, true); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | return json_decode($content, true); |
63 | 63 | } |
64 | 64 | |
65 | - protected function http(string $method, string $route, array $payload = []) |
|
65 | + protected function http(string $method, string $route, array $payload = [ ]) |
|
66 | 66 | { |
67 | 67 | return $this->sendRequest($method, $route, $payload, true); |
68 | 68 | } |
69 | 69 | |
70 | - private function sendRequest(string $method, string $route, array $payload = [], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
70 | + private function sendRequest(string $method, string $route, array $payload = [ ], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
71 | 71 | { |
72 | - return $this->json($method, env('API_URL') . '/' . $route, $payload, $authenticated ? [ |
|
73 | - 'Authorization' => 'Bearer ' . $this->getAuth0Service()->getTestUserToken()->id_token, |
|
74 | - ] : []); |
|
72 | + return $this->json($method, env('API_URL').'/'.$route, $payload, $authenticated ? [ |
|
73 | + 'Authorization' => 'Bearer '.$this->getAuth0Service()->getTestUserToken()->id_token, |
|
74 | + ] : [ ]); |
|
75 | 75 | } |
76 | 76 | |
77 | - protected function sendRequestWithToken($token, string $method, string $route, array $payload = [], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
77 | + protected function sendRequestWithToken($token, string $method, string $route, array $payload = [ ], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
78 | 78 | { |
79 | - return $this->json($method, env('API_URL') . '/' . $route, $payload, $authenticated ? [ |
|
80 | - 'Authorization' => 'Bearer ' . $token, |
|
81 | - ] : []); |
|
79 | + return $this->json($method, env('API_URL').'/'.$route, $payload, $authenticated ? [ |
|
80 | + 'Authorization' => 'Bearer '.$token, |
|
81 | + ] : [ ]); |
|
82 | 82 | } |
83 | 83 | |
84 | - protected function httpNoAuth(string $method, string $route, array $payload = []) |
|
84 | + protected function httpNoAuth(string $method, string $route, array $payload = [ ]) |
|
85 | 85 | { |
86 | 86 | return $this->sendRequest($method, $route, $payload, false); |
87 | 87 | } |
@@ -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 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | $this->seedData(); |
34 | 34 | } |
35 | 35 | |
36 | - protected function seedData(){} |
|
36 | + protected function seedData() {} |
|
37 | 37 | |
38 | 38 | protected function createUser() |
39 | 39 | { |
@@ -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 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | return static::$caching; |
29 | 29 | } |
30 | 30 | |
31 | - public static function find($id, $columns = ['*']) |
|
31 | + public static function find($id, $columns = [ '*' ]) |
|
32 | 32 | { |
33 | 33 | if (static::cache()->enabled()) { |
34 | 34 | $model = static::cache()->find($id) ?? static::recache($id); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | return $model; |
46 | 46 | } |
47 | 47 | |
48 | - public static function findWithoutCache($id, $columns = ['*']) |
|
48 | + public static function findWithoutCache($id, $columns = [ '*' ]) |
|
49 | 49 | { |
50 | 50 | $model = new static(); |
51 | 51 | if (is_array($id) || $id instanceof Arrayable) { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | if ($model === null) |
61 | 61 | return null; |
62 | 62 | |
63 | - if ($columns !== ['*']) { |
|
63 | + if ($columns !== [ '*' ]) { |
|
64 | 64 | return collect($model)->first($columns); |
65 | 65 | } |
66 | 66 |
@@ -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); |
@@ -22,7 +22,7 @@ |
||
22 | 22 | $this->artisan('cache:model:clear'); |
23 | 23 | $this->artisan('migrate:refresh'); |
24 | 24 | $this->artisan('db:seed'); |
25 | - $this->beforeApplicationDestroyed(function () { |
|
25 | + $this->beforeApplicationDestroyed(function() { |
|
26 | 26 | RefreshDatabaseState::$migrated = false; |
27 | 27 | }); |
28 | 28 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | protected function eagerLoadRelations($model) |
63 | 63 | { |
64 | 64 | if ($model !== null) |
65 | - return $model::eagerLoadRelations(array($model))[0]; |
|
65 | + return $model::eagerLoadRelations(array($model))[ 0 ]; |
|
66 | 66 | return null; |
67 | 67 | } |
68 | 68 | |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function getCacheName($id, string $index = 'id') |
78 | 78 | { |
79 | - return config('model.cache_prefix') . ':' . strtolower(get_short_class_name($this->model)) . ':' . $index . ':' . $id; |
|
79 | + return config('model.cache_prefix').':'.strtolower(get_short_class_name($this->model)).':'.$index.':'.$id; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | private static function deleteWithPrefix($prefix) |
135 | 135 | { |
136 | 136 | $redis = self::getCacheConnection(); |
137 | - $keyPattern = Cache::getPrefix() . $prefix . '*'; |
|
137 | + $keyPattern = Cache::getPrefix().$prefix.'*'; |
|
138 | 138 | $keys = $redis->keys($keyPattern); |
139 | 139 | $redis->delete($keys); |
140 | 140 | } |
@@ -160,12 +160,12 @@ discard block |
||
160 | 160 | */ |
161 | 161 | public function clearModelCache() |
162 | 162 | { |
163 | - $pattern = config('model.cache_prefix') . ':' . strtolower(get_short_class_name($this->model)); |
|
163 | + $pattern = config('model.cache_prefix').':'.strtolower(get_short_class_name($this->model)); |
|
164 | 164 | self::deleteWithPrefix($pattern); |
165 | 165 | } |
166 | 166 | |
167 | 167 | public function enabled(): bool |
168 | 168 | { |
169 | - return (bool)config('model.caching'); |
|
169 | + return (bool) config('model.caching'); |
|
170 | 170 | } |
171 | 171 | } |
@@ -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 |
@@ -38,7 +38,7 @@ |
||
38 | 38 | $this->app->register(\Foundation\Providers\TelescopeServiceProvider::class); |
39 | 39 | } |
40 | 40 | |
41 | - private function registerNonTestingPackages(){ |
|
41 | + private function registerNonTestingPackages() { |
|
42 | 42 | $this->app->register(\Laravel\Horizon\HorizonServiceProvider::class); |
43 | 43 | } |
44 | 44 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | public function register() |
19 | 19 | { |
20 | 20 | $this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class); |
21 | - //Telescope::night(); |
|
21 | + //Telescope::night(); |
|
22 | 22 | |
23 | 23 | Telescope::filter(function (IncomingEntry $entry) { |
24 | 24 |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | $this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class); |
21 | 21 | //Telescope::night(); |
22 | 22 | |
23 | - Telescope::filter(function (IncomingEntry $entry) { |
|
23 | + Telescope::filter(function(IncomingEntry $entry) { |
|
24 | 24 | |
25 | 25 | if ($entry->type === EntryType::REQUEST |
26 | - && isset($entry->content['uri']) |
|
27 | - && str_contains($entry->content['uri'], 'horizon')) { |
|
26 | + && isset($entry->content[ 'uri' ]) |
|
27 | + && str_contains($entry->content[ 'uri' ], 'horizon')) { |
|
28 | 28 | return false; |
29 | 29 | } |
30 | 30 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | */ |
49 | 49 | protected function gate() |
50 | 50 | { |
51 | - Gate::define('viewTelescope', function ($user) { |
|
51 | + Gate::define('viewTelescope', function($user) { |
|
52 | 52 | return in_array($user->email, [ |
53 | 53 | // |
54 | 54 | ]); |