@@ -38,14 +38,14 @@  | 
                                                    ||
| 38 | 38 | $user = $this->auth0Repository->getUserByDecodedJWT($tokenInfo);  | 
                                                        
| 39 | 39 | |
| 40 | 40 |              if (!$user) { | 
                                                        
| 41 | - return response()->json(['error' => 'Unauthorized user.'], 401);  | 
                                                        |
| 41 | + return response()->json([ 'error' => 'Unauthorized user.' ], 401);  | 
                                                        |
| 42 | 42 | }  | 
                                                        
| 43 | 43 | |
| 44 | 44 | \Auth::login($user);  | 
                                                        
| 45 | 45 |          } catch (InvalidTokenException $e) { | 
                                                        
| 46 | - return response()->json(['error' => 'Invalid or no token set.'], 401);  | 
                                                        |
| 46 | + return response()->json([ 'error' => 'Invalid or no token set.' ], 401);  | 
                                                        |
| 47 | 47 |          } catch (CoreException $e) { | 
                                                        
| 48 | - return response()->json(['error' => $e->getMessage()], 401);  | 
                                                        |
| 48 | + return response()->json([ 'error' => $e->getMessage() ], 401);  | 
                                                        |
| 49 | 49 | }  | 
                                                        
| 50 | 50 | |
| 51 | 51 | return $next($request);  | 
                                                        
@@ -65,9 +65,9 @@ discard block  | 
                                                    ||
| 65 | 65 | |
| 66 | 66 | private function buildEmptyBootstrapArray()  | 
                                                        
| 67 | 67 |      { | 
                                                        
| 68 | - $bootstrapArray = [];  | 
                                                        |
| 68 | + $bootstrapArray = [ ];  | 
                                                        |
| 69 | 69 |          foreach ($this->moduleEntityDirectories as $key => $directory) { | 
                                                        
| 70 | - $bootstrapArray[$key] = [];  | 
                                                        |
| 70 | + $bootstrapArray[ $key ] = [ ];  | 
                                                        |
| 71 | 71 | }  | 
                                                        
| 72 | 72 | |
| 73 | 73 | return $bootstrapArray;  | 
                                                        
@@ -92,26 +92,26 @@ discard block  | 
                                                    ||
| 92 | 92 |                                      try { | 
                                                        
| 93 | 93 | $command = new $class();  | 
                                                        
| 94 | 94 |                                          if ($command instanceof Command) { | 
                                                        
| 95 | - $bootstrap[$key][] = $class;  | 
                                                        |
| 95 | + $bootstrap[ $key ][ ] = $class;  | 
                                                        |
| 96 | 96 | }  | 
                                                        
| 97 | 97 |                                      } catch (\Exception $e) { | 
                                                        
| 98 | 98 | break;  | 
                                                        
| 99 | 99 | }  | 
                                                        
| 100 | 100 | break;  | 
                                                        
| 101 | 101 | case 'routes':  | 
                                                        
| 102 | - $bootstrap[$key][] = $this->buildRouteArray($directoryPath.'/'.$fileName, $namespace);  | 
                                                        |
| 102 | + $bootstrap[ $key ][ ] = $this->buildRouteArray($directoryPath.'/'.$fileName, $namespace);  | 
                                                        |
| 103 | 103 | break;  | 
                                                        
| 104 | 104 | case 'configs':  | 
                                                        
| 105 | - $bootstrap[$key][] = $this->buildConfigArray($directoryPath.'/'.$fileName, $module->getName());  | 
                                                        |
| 105 | + $bootstrap[ $key ][ ] = $this->buildConfigArray($directoryPath.'/'.$fileName, $module->getName());  | 
                                                        |
| 106 | 106 | break;  | 
                                                        
| 107 | 107 | case 'factories':  | 
                                                        
| 108 | - $bootstrap[$key][] = $this->buildDirectoryPathArray($directoryPath);  | 
                                                        |
| 108 | + $bootstrap[ $key ][ ] = $this->buildDirectoryPathArray($directoryPath);  | 
                                                        |
| 109 | 109 | break;  | 
                                                        
| 110 | 110 | case 'migrations':  | 
                                                        
| 111 | - $bootstrap[$key][] = $this->buildDirectoryPathArray($directoryPath);  | 
                                                        |
| 111 | + $bootstrap[ $key ][ ] = $this->buildDirectoryPathArray($directoryPath);  | 
                                                        |
| 112 | 112 | break;  | 
                                                        
| 113 | 113 | case 'seeders':  | 
                                                        
| 114 | - $bootstrap[$key][] = $class;  | 
                                                        |
| 114 | + $bootstrap[ $key ][ ] = $class;  | 
                                                        |
| 115 | 115 | break;  | 
                                                        
| 116 | 116 | default:  | 
                                                        
| 117 | 117 | break;  | 
                                                        
@@ -127,7 +127,7 @@ discard block  | 
                                                    ||
| 127 | 127 | |
| 128 | 128 | private function hasPhpExtension(string $fileName): bool  | 
                                                        
| 129 | 129 |      { | 
                                                        
| 130 | - return strlen($fileName) > 4 && '.php' === ($fileName[-4].$fileName[-3].$fileName[-2].$fileName[-1]);  | 
                                                        |
| 130 | + return strlen($fileName) > 4 && '.php' === ($fileName[-4 ].$fileName[-3 ].$fileName[-2 ].$fileName[-1 ]);  | 
                                                        |
| 131 | 131 | }  | 
                                                        
| 132 | 132 | |
| 133 | 133 | public function loadBootstrapFromCache()  | 
                                                        
@@ -149,7 +149,7 @@ discard block  | 
                                                    ||
| 149 | 149 |          $apiDomain = str_replace('http://', '', $apiDomain); | 
                                                        
| 150 | 150 |          $apiDomain = str_replace('https://', '', $apiDomain); | 
                                                        
| 151 | 151 | $moduleNamespace = $namespace;  | 
                                                        
| 152 | -        $moduleName = explode('\\', $moduleNamespace)[1]; | 
                                                        |
| 152 | +        $moduleName = explode('\\', $moduleNamespace)[ 1 ]; | 
                                                        |
| 153 | 153 | $controllerNamespace = $moduleNamespace.'\\'.'Http\\Controllers';  | 
                                                        
| 154 | 154 | $modelNameSpace = $moduleNamespace.'\\'.'Entities\\'.$moduleName;  | 
                                                        
| 155 | 155 | |
@@ -180,31 +180,31 @@ discard block  | 
                                                    ||
| 180 | 180 | |
| 181 | 181 | public function getCommands(): array  | 
                                                        
| 182 | 182 |      { | 
                                                        
| 183 | - return $this->loadBootstrapFromCache()['commands'] ?? [];  | 
                                                        |
| 183 | + return $this->loadBootstrapFromCache()[ 'commands' ] ?? [ ];  | 
                                                        |
| 184 | 184 | }  | 
                                                        
| 185 | 185 | |
| 186 | 186 | public function getRoutes(): array  | 
                                                        
| 187 | 187 |      { | 
                                                        
| 188 | - return $this->loadBootstrapFromCache()['routes'] ?? [];  | 
                                                        |
| 188 | + return $this->loadBootstrapFromCache()[ 'routes' ] ?? [ ];  | 
                                                        |
| 189 | 189 | }  | 
                                                        
| 190 | 190 | |
| 191 | 191 | public function getConfigs(): array  | 
                                                        
| 192 | 192 |      { | 
                                                        
| 193 | - return $this->loadBootstrapFromCache()['configs'] ?? [];  | 
                                                        |
| 193 | + return $this->loadBootstrapFromCache()[ 'configs' ] ?? [ ];  | 
                                                        |
| 194 | 194 | }  | 
                                                        
| 195 | 195 | |
| 196 | 196 | public function getFactories(): array  | 
                                                        
| 197 | 197 |      { | 
                                                        
| 198 | - return $this->loadBootstrapFromCache()['factories'] ?? [];  | 
                                                        |
| 198 | + return $this->loadBootstrapFromCache()[ 'factories' ] ?? [ ];  | 
                                                        |
| 199 | 199 | }  | 
                                                        
| 200 | 200 | |
| 201 | 201 | public function getMigrations(): array  | 
                                                        
| 202 | 202 |      { | 
                                                        
| 203 | - return $this->loadBootstrapFromCache()['migrations'] ?? [];  | 
                                                        |
| 203 | + return $this->loadBootstrapFromCache()[ 'migrations' ] ?? [ ];  | 
                                                        |
| 204 | 204 | }  | 
                                                        
| 205 | 205 | |
| 206 | 206 | public function getSeeders(): array  | 
                                                        
| 207 | 207 |      { | 
                                                        
| 208 | - return $this->loadBootstrapFromCache()['seeders'] ?? [];  | 
                                                        |
| 208 | + return $this->loadBootstrapFromCache()[ 'seeders' ] ?? [ ];  | 
                                                        |
| 209 | 209 | }  | 
                                                        
| 210 | 210 | }  | 
                                                        
@@ -27,7 +27,7 @@ discard block  | 
                                                    ||
| 27 | 27 | |
| 28 | 28 | private function getUserTokenData(): \stdClass  | 
                                                        
| 29 | 29 |      { | 
                                                        
| 30 | -        return Cache::remember('testing:http_access_token', 60, function () { | 
                                                        |
| 30 | +        return Cache::remember('testing:http_access_token', 60, function() { | 
                                                        |
| 31 | 31 | $httpClient = new Client();  | 
                                                        
| 32 | 32 |              $response = $httpClient->post(config('laravel-auth0.domain').'oauth/token', [ | 
                                                        
| 33 | 33 | 'form_params' => [  | 
                                                        
@@ -43,19 +43,19 @@ discard block  | 
                                                    ||
| 43 | 43 | });  | 
                                                        
| 44 | 44 | }  | 
                                                        
| 45 | 45 | |
| 46 | - protected function http(string $method, string $route, array $payload = [])  | 
                                                        |
| 46 | + protected function http(string $method, string $route, array $payload = [ ])  | 
                                                        |
| 47 | 47 |      { | 
                                                        
| 48 | 48 | return $this->sendRequest($method, $route, $payload, true);  | 
                                                        
| 49 | 49 | }  | 
                                                        
| 50 | 50 | |
| 51 | - private function sendRequest(string $method, string $route, array $payload = [], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse  | 
                                                        |
| 51 | + private function sendRequest(string $method, string $route, array $payload = [ ], $authenticated = true): \Illuminate\Foundation\Testing\TestResponse  | 
                                                        |
| 52 | 52 |      { | 
                                                        
| 53 | 53 |          return $this->json($method, env('API_URL').'/'.$route, $payload, $authenticated ? [ | 
                                                        
| 54 | 54 | 'Authorization' => 'Bearer '.$this->getUserTokenData()->id_token,  | 
                                                        
| 55 | - ] : []);  | 
                                                        |
| 55 | + ] : [ ]);  | 
                                                        |
| 56 | 56 | }  | 
                                                        
| 57 | 57 | |
| 58 | - protected function httpNoAuth(string $method, string $route, array $payload = [])  | 
                                                        |
| 58 | + protected function httpNoAuth(string $method, string $route, array $payload = [ ])  | 
                                                        |
| 59 | 59 |      { | 
                                                        
| 60 | 60 | return $this->sendRequest($method, $route, $payload, false);  | 
                                                        
| 61 | 61 | }  | 
                                                        
@@ -49,16 +49,16 @@ discard block  | 
                                                    ||
| 49 | 49 | private function loadRoutes()  | 
                                                        
| 50 | 50 |      { | 
                                                        
| 51 | 51 |          foreach ($this->bootstrapService->getRoutes() as $route) { | 
                                                        
| 52 | - $path = $route['path'];  | 
                                                        |
| 52 | + $path = $route[ 'path' ];  | 
                                                        |
| 53 | 53 | Route::group([  | 
                                                        
| 54 | - 'prefix' => 'v1/'.$route['module'],  | 
                                                        |
| 55 | - 'namespace' => $route['controller'],  | 
                                                        |
| 56 | - 'domain' => $route['domain'],  | 
                                                        |
| 57 | - 'middleware' => ['api'],  | 
                                                        |
| 58 | -            ], function (Router $router) use ($path) { | 
                                                        |
| 54 | + 'prefix' => 'v1/'.$route[ 'module' ],  | 
                                                        |
| 55 | + 'namespace' => $route[ 'controller' ],  | 
                                                        |
| 56 | + 'domain' => $route[ 'domain' ],  | 
                                                        |
| 57 | + 'middleware' => [ 'api' ],  | 
                                                        |
| 58 | +            ], function(Router $router) use ($path) { | 
                                                        |
| 59 | 59 | require $path;  | 
                                                        
| 60 | 60 | });  | 
                                                        
| 61 | - Route::model($route['module'], $route['model']);  | 
                                                        |
| 61 | + Route::model($route[ 'module' ], $route[ 'model' ]);  | 
                                                        |
| 62 | 62 | }  | 
                                                        
| 63 | 63 | }  | 
                                                        
| 64 | 64 | |
@@ -71,10 +71,10 @@ discard block  | 
                                                    ||
| 71 | 71 |      { | 
                                                        
| 72 | 72 |          foreach ($this->bootstrapService->getConfigs() as $config) { | 
                                                        
| 73 | 73 | $this->publishes([  | 
                                                        
| 74 | - $config['path'] => config_path($config['module']),  | 
                                                        |
| 74 | + $config[ 'path' ] => config_path($config[ 'module' ]),  | 
                                                        |
| 75 | 75 | ], 'config');  | 
                                                        
| 76 | 76 | $this->mergeConfigFrom(  | 
                                                        
| 77 | - $config['path'], basename($config['module'], '.php')  | 
                                                        |
| 77 | + $config[ 'path' ], basename($config[ 'module' ], '.php')  | 
                                                        |
| 78 | 78 | );  | 
                                                        
| 79 | 79 | }  | 
                                                        
| 80 | 80 | }  | 
                                                        
@@ -88,7 +88,7 @@ discard block  | 
                                                    ||
| 88 | 88 |      { | 
                                                        
| 89 | 89 |          foreach ($this->bootstrapService->getFactories() as $factory) { | 
                                                        
| 90 | 90 |              if (!$this->app->environment('production')) { | 
                                                        
| 91 | - app(Factory::class)->load($factory['path']);  | 
                                                        |
| 91 | + app(Factory::class)->load($factory[ 'path' ]);  | 
                                                        |
| 92 | 92 | }  | 
                                                        
| 93 | 93 | }  | 
                                                        
| 94 | 94 | }  | 
                                                        
@@ -101,7 +101,7 @@ discard block  | 
                                                    ||
| 101 | 101 | public function loadMigrations()  | 
                                                        
| 102 | 102 |      { | 
                                                        
| 103 | 103 |          foreach ($this->bootstrapService->getMigrations() as $migration) { | 
                                                        
| 104 | - $this->loadMigrationsFrom($migration['path']);  | 
                                                        |
| 104 | + $this->loadMigrationsFrom($migration[ 'path' ]);  | 
                                                        |
| 105 | 105 | }  | 
                                                        
| 106 | 106 | }  | 
                                                        
| 107 | 107 | |
@@ -114,8 +114,8 @@ discard block  | 
                                                    ||
| 114 | 114 |      { | 
                                                        
| 115 | 115 | $app = $this->app;  | 
                                                        
| 116 | 116 | $service = $this->bootstrapService;  | 
                                                        
| 117 | -        $this->app->extend('command.seed', function () use ($app, $service) { | 
                                                        |
| 118 | - return new SeedCommand($app['db'], $service);  | 
                                                        |
| 117 | +        $this->app->extend('command.seed', function() use ($app, $service) { | 
                                                        |
| 118 | + return new SeedCommand($app[ 'db' ], $service);  | 
                                                        |
| 119 | 119 | });  | 
                                                        
| 120 | 120 | }  | 
                                                        
| 121 | 121 | }  |