@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * @var array |
27 | 27 | */ |
28 | - protected $guarded = []; |
|
28 | + protected $guarded = [ ]; |
|
29 | 29 | /** |
30 | 30 | * The attributes that should be cast to native types. |
31 | 31 | * |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | public function markAsRead() |
53 | 53 | { |
54 | 54 | if (is_null($this->read_at)) { |
55 | - $this->forceFill(['read_at' => $this->freshTimestamp()])->save(); |
|
55 | + $this->forceFill([ 'read_at' => $this->freshTimestamp() ])->save(); |
|
56 | 56 | } |
57 | 57 | } |
58 | 58 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param array $models |
83 | 83 | * @return \Illuminate\Notifications\DatabaseNotificationCollection |
84 | 84 | */ |
85 | - public function newCollection(array $models = []) |
|
85 | + public function newCollection(array $models = [ ]) |
|
86 | 86 | { |
87 | 87 | return new DatabaseNotificationCollection($models); |
88 | 88 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | { |
30 | 30 | $this->overrideSeedCommand(); |
31 | 31 | |
32 | - if ((bool)config('model.caching')) { |
|
32 | + if ((bool) config('model.caching')) { |
|
33 | 33 | $this->loadCacheObservers(); |
34 | 34 | } |
35 | 35 | |
@@ -74,16 +74,16 @@ discard block |
||
74 | 74 | private function loadRoutes() |
75 | 75 | { |
76 | 76 | foreach ($this->bootstrapService->getRoutes() as $route) { |
77 | - $path = $route['path']; |
|
77 | + $path = $route[ 'path' ]; |
|
78 | 78 | Route::group([ |
79 | - 'prefix' => 'v1/' . $route['module'], |
|
80 | - 'namespace' => $route['controller'], |
|
81 | - 'domain' => $route['domain'], |
|
82 | - 'middleware' => ['api'], |
|
83 | - ], function () use ($path) { |
|
79 | + 'prefix' => 'v1/'.$route[ 'module' ], |
|
80 | + 'namespace' => $route[ 'controller' ], |
|
81 | + 'domain' => $route[ 'domain' ], |
|
82 | + 'middleware' => [ 'api' ], |
|
83 | + ], function() use ($path) { |
|
84 | 84 | require $path; |
85 | 85 | }); |
86 | - Route::model($route['module'], $route['model']); |
|
86 | + Route::model($route[ 'module' ], $route[ 'model' ]); |
|
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | protected function loadConfigs() |
96 | 96 | { |
97 | 97 | foreach ($this->bootstrapService->getConfigs() as $config) { |
98 | - if ($config['filename'] === 'config.php') { |
|
98 | + if ($config[ 'filename' ] === 'config.php') { |
|
99 | 99 | $this->publishes([ |
100 | - $config['path'] => config_path($config['module']), |
|
100 | + $config[ 'path' ] => config_path($config[ 'module' ]), |
|
101 | 101 | ], 'config'); |
102 | 102 | $this->mergeConfigFrom( |
103 | - $config['path'], basename($config['module'], '.php') |
|
103 | + $config[ 'path' ], basename($config[ 'module' ], '.php') |
|
104 | 104 | ); |
105 | 105 | } |
106 | 106 | } |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | { |
116 | 116 | foreach ($this->bootstrapService->getFactories() as $factory) { |
117 | 117 | if (!$this->app->environment('production')) { |
118 | - app(Factory::class)->load($factory['path']); |
|
118 | + app(Factory::class)->load($factory[ 'path' ]); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | } |
@@ -128,15 +128,15 @@ discard block |
||
128 | 128 | public function loadMigrations() |
129 | 129 | { |
130 | 130 | foreach ($this->bootstrapService->getMigrations() as $migration) { |
131 | - $this->loadMigrationsFrom($migration['path']); |
|
131 | + $this->loadMigrationsFrom($migration[ 'path' ]); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | |
135 | 135 | private function loadPolicies() |
136 | 136 | { |
137 | 137 | foreach ($this->bootstrapService->getPolicies() as $policy) { |
138 | - if (class_implements_interface($policy['class'], ModelPolicyContract::class)) { |
|
139 | - Gate::policy($policy['model'], $policy['class']); |
|
138 | + if (class_implements_interface($policy[ 'class' ], ModelPolicyContract::class)) { |
|
139 | + Gate::policy($policy[ 'model' ], $policy[ 'class' ]); |
|
140 | 140 | } |
141 | 141 | } |
142 | 142 | } |
@@ -145,8 +145,8 @@ discard block |
||
145 | 145 | { |
146 | 146 | $app = $this->app; |
147 | 147 | $service = $this->bootstrapService; |
148 | - $this->app->extend('command.seed', function () use ($app, $service) { |
|
149 | - return new SeedCommand($app['db'], $service); |
|
148 | + $this->app->extend('command.seed', function() use ($app, $service) { |
|
149 | + return new SeedCommand($app[ 'db' ], $service); |
|
150 | 150 | }); |
151 | 151 | } |
152 | 152 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | foreach ($this->bootstrapService->getModels() as $model) { |
165 | 165 | if (class_implements_interface($model, Ownable::class)) { |
166 | 166 | Gate::policy($model, OwnershipPolicy::class); |
167 | - Gate::define('access', OwnershipPolicy::class . '@access'); |
|
167 | + Gate::define('access', OwnershipPolicy::class.'@access'); |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | } |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | private function loadListeners() |
180 | 180 | { |
181 | 181 | foreach ($this->bootstrapService->getEvents() as $event) { |
182 | - foreach ($event['listeners'] as $listener) { |
|
183 | - Event::listen($event['class'], $listener); |
|
182 | + foreach ($event[ 'listeners' ] as $listener) { |
|
183 | + Event::listen($event[ 'class' ], $listener); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | } |
@@ -39,14 +39,14 @@ |
||
39 | 39 | |
40 | 40 | |
41 | 41 | if (!$user) { |
42 | - return response()->json(['error' => 'Unauthorized user.'], 401); |
|
42 | + return response()->json([ 'error' => 'Unauthorized user.' ], 401); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | \Auth::login($user); |
46 | 46 | } catch (InvalidTokenException $e) { |
47 | - return response()->json(['error' => 'Invalid or no token set.'], 401); |
|
47 | + return response()->json([ 'error' => 'Invalid or no token set.' ], 401); |
|
48 | 48 | } catch (CoreException $e) { |
49 | - return response()->json(['error' => $e->getMessage()], 401); |
|
49 | + return response()->json([ 'error' => $e->getMessage() ], 401); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | return $next($request); |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | public function getUserByUserInfo($userInfo) |
44 | 44 | { |
45 | - return $this->upsertUser($userInfo['profile']); |
|
45 | + return $this->upsertUser($userInfo[ 'profile' ]); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | protected function upsertUser($profile) |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | throw new BadRequestHttpException('Missing token information: Auth0 user id is not set'); |
52 | 52 | } |
53 | 53 | $identifier = explode('|', $profile->user_id); |
54 | - $identityProvider = $identifier[0]; |
|
55 | - $id = $identifier[1]; |
|
54 | + $identityProvider = $identifier[ 0 ]; |
|
55 | + $id = $identifier[ 1 ]; |
|
56 | 56 | |
57 | 57 | $user = $this->service->find($id); |
58 | 58 | if ($user === null) { |
@@ -44,11 +44,11 @@ discard block |
||
44 | 44 | |
45 | 45 | private function getUserTokenData(): \stdClass |
46 | 46 | { |
47 | - return Cache::remember('testing:http_access_token', 60, function () { |
|
47 | + return Cache::remember('testing:http_access_token', 60, function() { |
|
48 | 48 | try { |
49 | 49 | $httpClient = new Client(); |
50 | 50 | $domain = 'https://astral.eu.auth0.com/'; |
51 | - $response = $httpClient->post($domain . 'oauth/token', [ |
|
51 | + $response = $httpClient->post($domain.'oauth/token', [ |
|
52 | 52 | 'form_params' => [ |
53 | 53 | 'grant_type' => 'password', |
54 | 54 | 'client_id' => env('AUTH0_CLIENT_ID'), |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | ]); |
60 | 60 | return json_decode($response->getBody()->getContents()); |
61 | 61 | } catch (ClientException $exception) { |
62 | - throw new Exception("Could not obtain token from Auth0 for testing from $domain" . $exception->getMessage()); |
|
62 | + throw new Exception("Could not obtain token from Auth0 for testing from $domain".$exception->getMessage()); |
|
63 | 63 | } |
64 | 64 | }); |
65 | 65 | } |
@@ -67,30 +67,30 @@ discard block |
||
67 | 67 | protected function decodeHttpContent($content, $unwrap = true) |
68 | 68 | { |
69 | 69 | if ($unwrap) |
70 | - return json_decode($content, true)['data']; |
|
70 | + return json_decode($content, true)[ 'data' ]; |
|
71 | 71 | return json_decode($content, true); |
72 | 72 | } |
73 | 73 | |
74 | - protected function http(string $method, string $route, array $payload = []) |
|
74 | + protected function http(string $method, string $route, array $payload = [ ]) |
|
75 | 75 | { |
76 | 76 | return $this->sendRequest($method, $route, $payload, true); |
77 | 77 | } |
78 | 78 | |
79 | - private function sendRequest(string $method, string $route, array $payload = [], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
79 | + private function sendRequest(string $method, string $route, array $payload = [ ], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
80 | 80 | { |
81 | - return $this->json($method, env('API_URL') . '/' . $route, $payload, $authenticated ? [ |
|
82 | - 'Authorization' => 'Bearer ' . $this->getUserTokenData()->id_token, |
|
83 | - ] : []); |
|
81 | + return $this->json($method, env('API_URL').'/'.$route, $payload, $authenticated ? [ |
|
82 | + 'Authorization' => 'Bearer '.$this->getUserTokenData()->id_token, |
|
83 | + ] : [ ]); |
|
84 | 84 | } |
85 | 85 | |
86 | - protected function sendRequestWithToken($token, string $method, string $route, array $payload = [], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
86 | + protected function sendRequestWithToken($token, string $method, string $route, array $payload = [ ], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse |
|
87 | 87 | { |
88 | - return $this->json($method, env('API_URL') . '/' . $route, $payload, $authenticated ? [ |
|
89 | - 'Authorization' => 'Bearer ' . $token, |
|
90 | - ] : []); |
|
88 | + return $this->json($method, env('API_URL').'/'.$route, $payload, $authenticated ? [ |
|
89 | + 'Authorization' => 'Bearer '.$token, |
|
90 | + ] : [ ]); |
|
91 | 91 | } |
92 | 92 | |
93 | - protected function httpNoAuth(string $method, string $route, array $payload = []) |
|
93 | + protected function httpNoAuth(string $method, string $route, array $payload = [ ]) |
|
94 | 94 | { |
95 | 95 | return $this->sendRequest($method, $route, $payload, false); |
96 | 96 | } |