@@ -141,6 +141,6 @@ |
||
| 141 | 141 | | |
| 142 | 142 | */ |
| 143 | 143 | |
| 144 | - 'attributes' => [], |
|
| 144 | + 'attributes' => [ ], |
|
| 145 | 145 | |
| 146 | 146 | ]; |
@@ -2,7 +2,7 @@ |
||
| 2 | 2 | |
| 3 | 3 | use Modules\User\Entities\User; |
| 4 | 4 | |
| 5 | -$factory->define(User::class, function (Faker\Generator $faker) { |
|
| 5 | +$factory->define(User::class, function(Faker\Generator $faker) { |
|
| 6 | 6 | return [ |
| 7 | 7 | 'auth0_id' => null, |
| 8 | 8 | 'name' => $faker->name, |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | */ |
| 17 | 17 | protected $commands = [ |
| 18 | 18 | BootstrapCacheCommand::class, |
| 19 | - // SeedCommand::class |
|
| 19 | + // SeedCommand::class |
|
| 20 | 20 | ]; |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -52,14 +52,14 @@ discard block |
||
| 52 | 52 | $apiDomain = strtolower(env('API_URL')); |
| 53 | 53 | $apiDomain = str_replace('http://', '', $apiDomain); |
| 54 | 54 | $apiDomain = str_replace('https://', '', $apiDomain); |
| 55 | - $namespace = $route[1] . '\\' . 'Http\\Controllers'; |
|
| 56 | - $filepath = $route[0]; |
|
| 55 | + $namespace = $route[ 1 ].'\\'.'Http\\Controllers'; |
|
| 56 | + $filepath = $route[ 0 ]; |
|
| 57 | 57 | Route::group([ |
| 58 | 58 | 'prefix' => 'v1', |
| 59 | 59 | 'namespace' => $namespace, |
| 60 | 60 | 'domain' => $apiDomain, |
| 61 | - 'middleware' => [] |
|
| 62 | - ], function (Router $router) use ($filepath) { |
|
| 61 | + 'middleware' => [ ] |
|
| 62 | + ], function(Router $router) use ($filepath) { |
|
| 63 | 63 | require $filepath; |
| 64 | 64 | }); |
| 65 | 65 | } |
@@ -74,10 +74,10 @@ discard block |
||
| 74 | 74 | { |
| 75 | 75 | foreach ($this->bootstrapService->getConfigs() as $route) { |
| 76 | 76 | $this->publishes([ |
| 77 | - $route[0] => config_path($route[1]), |
|
| 77 | + $route[ 0 ] => config_path($route[ 1 ]), |
|
| 78 | 78 | ], 'config'); |
| 79 | 79 | $this->mergeConfigFrom( |
| 80 | - $route[0], basename($route[1], '.php') |
|
| 80 | + $route[ 0 ], basename($route[ 1 ], '.php') |
|
| 81 | 81 | ); |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -119,8 +119,8 @@ discard block |
||
| 119 | 119 | { |
| 120 | 120 | $app = $this->app; |
| 121 | 121 | $service = $this->bootstrapService; |
| 122 | - $this->app->extend('command.seed', function () use ($app, $service) { |
|
| 123 | - return new SeedCommand($app['db'], $service); |
|
| 122 | + $this->app->extend('command.seed', function() use ($app, $service) { |
|
| 123 | + return new SeedCommand($app[ 'db' ], $service); |
|
| 124 | 124 | }); |
| 125 | 125 | } |
| 126 | 126 | } |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function getUserByUserInfo($userInfo) { |
| 41 | - return $this->upsertUser($userInfo['profile']); |
|
| 41 | + return $this->upsertUser($userInfo[ 'profile' ]); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | protected function upsertUser($profile) { |
@@ -62,7 +62,9 @@ |
||
| 62 | 62 | //Get the user info of the user logged in (probably in session) |
| 63 | 63 | $user = \App::make('auth0')->getUser(); |
| 64 | 64 | |
| 65 | - if ($user === null) return null; |
|
| 65 | + if ($user === null) { |
|
| 66 | + return null; |
|
| 67 | + } |
|
| 66 | 68 | |
| 67 | 69 | // build the user |
| 68 | 70 | $user = $this->getUserByUserInfo($user); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | $this->resolver->setDefaultConnection($this->getDatabase()); |
| 37 | 37 | |
| 38 | - Model::unguarded(function () { |
|
| 38 | + Model::unguarded(function() { |
|
| 39 | 39 | foreach ($this->getSeeders() as $seeder) { |
| 40 | 40 | $seeder = $this->laravel->make($seeder); |
| 41 | 41 | $seeder->__invoke(); |
@@ -48,6 +48,6 @@ discard block |
||
| 48 | 48 | protected function getSeeders(): array |
| 49 | 49 | { |
| 50 | 50 | $this->service = $this->laravel->make(BootstrapRegistrarService::class); |
| 51 | - return $this->service->getSeeders() ?? []; |
|
| 51 | + return $this->service->getSeeders() ?? [ ]; |
|
| 52 | 52 | } |
| 53 | 53 | } |
@@ -41,43 +41,43 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | public function scanDirectories(): array |
| 43 | 43 | { |
| 44 | - $bootstrap = []; |
|
| 44 | + $bootstrap = [ ]; |
|
| 45 | 45 | $modules = \Module::all(); |
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | foreach ($modules as $module) { |
| 49 | 49 | foreach ($this->moduleEntityDirectories as $key => $directory) { |
| 50 | 50 | $directory = ucfirst($directory); |
| 51 | - $directoryPath = $module->getPath() . '/' . $directory; |
|
| 52 | - $namespace = 'Modules' . '\\' . $module->getName(); |
|
| 51 | + $directoryPath = $module->getPath().'/'.$directory; |
|
| 52 | + $namespace = 'Modules'.'\\'.$module->getName(); |
|
| 53 | 53 | if (file_exists($directoryPath)) { |
| 54 | 54 | $files = scandir($directoryPath); |
| 55 | 55 | foreach ($files as $fileName) { |
| 56 | 56 | if ($this->hasPhpExtension($fileName)) { |
| 57 | 57 | $className = basename($fileName, '.php'); |
| 58 | - $class = $namespace . '\\' . str_replace('/', '\\', $directory) . '\\' . $className; |
|
| 58 | + $class = $namespace.'\\'.str_replace('/', '\\', $directory).'\\'.$className; |
|
| 59 | 59 | |
| 60 | 60 | try { |
| 61 | 61 | switch ($key) { |
| 62 | 62 | case 'commands': |
| 63 | 63 | if (new $class() instanceof Command) { |
| 64 | - $bootstrap[$key][] = $class; |
|
| 64 | + $bootstrap[ $key ][ ] = $class; |
|
| 65 | 65 | } |
| 66 | 66 | break; |
| 67 | 67 | case 'routes': |
| 68 | - $bootstrap[$key][] = [$directoryPath . '/' . $fileName, $namespace]; |
|
| 68 | + $bootstrap[ $key ][ ] = [ $directoryPath.'/'.$fileName, $namespace ]; |
|
| 69 | 69 | break; |
| 70 | 70 | case 'configs': |
| 71 | - $bootstrap[$key][] = [$directoryPath . '/' . $fileName, strtolower($module->getName())]; |
|
| 71 | + $bootstrap[ $key ][ ] = [ $directoryPath.'/'.$fileName, strtolower($module->getName()) ]; |
|
| 72 | 72 | break; |
| 73 | 73 | case 'factories': |
| 74 | - $bootstrap[$key][] = $directoryPath; |
|
| 74 | + $bootstrap[ $key ][ ] = $directoryPath; |
|
| 75 | 75 | break; |
| 76 | 76 | case 'migrations': |
| 77 | - $bootstrap[$key][] = $directoryPath; |
|
| 77 | + $bootstrap[ $key ][ ] = $directoryPath; |
|
| 78 | 78 | break; |
| 79 | 79 | case 'seeders': |
| 80 | - $bootstrap[$key][] = $class; |
|
| 80 | + $bootstrap[ $key ][ ] = $class; |
|
| 81 | 81 | break; |
| 82 | 82 | default: |
| 83 | 83 | break; |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | private function hasPhpExtension(string $fileName): bool |
| 99 | 99 | { |
| 100 | - return strlen($fileName) > 4 && '.php' === ($fileName[-4] . $fileName[-3] . $fileName[-2] . $fileName[-1]); |
|
| 100 | + return strlen($fileName) > 4 && '.php' === ($fileName[-4 ].$fileName[-3 ].$fileName[-2 ].$fileName[-1 ]); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | private function loadBootstrapFromCache() |
@@ -113,36 +113,36 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | public function getCommands(): array |
| 115 | 115 | { |
| 116 | - return $this->loadBootstrapFromCache()['commands'] ?? []; |
|
| 116 | + return $this->loadBootstrapFromCache()[ 'commands' ] ?? [ ]; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | public function getRoutes(): array |
| 120 | 120 | { |
| 121 | - return $this->loadBootstrapFromCache()['routes'] ?? []; |
|
| 121 | + return $this->loadBootstrapFromCache()[ 'routes' ] ?? [ ]; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | public function getConfigs(): array |
| 125 | 125 | { |
| 126 | - return $this->loadBootstrapFromCache()['configs'] ?? []; |
|
| 126 | + return $this->loadBootstrapFromCache()[ 'configs' ] ?? [ ]; |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | public function getFactories(): array |
| 130 | 130 | { |
| 131 | - return $this->loadBootstrapFromCache()['factories'] ?? []; |
|
| 131 | + return $this->loadBootstrapFromCache()[ 'factories' ] ?? [ ]; |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | public function getMigrations(): array |
| 135 | 135 | { |
| 136 | - return $this->loadBootstrapFromCache()['migrations'] ?? []; |
|
| 136 | + return $this->loadBootstrapFromCache()[ 'migrations' ] ?? [ ]; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | public function getSeeders(): array |
| 140 | 140 | { |
| 141 | - return $this->loadBootstrapFromCache()['seeders'] ?? []; |
|
| 141 | + return $this->loadBootstrapFromCache()[ 'seeders' ] ?? [ ]; |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | public function getCachePath(): string |
| 145 | 145 | { |
| 146 | - return app()->bootstrapPath() . '/cache/' . $this->cacheFile; |
|
| 146 | + return app()->bootstrapPath().'/cache/'.$this->cacheFile; |
|
| 147 | 147 | } |
| 148 | 148 | } |
@@ -35,14 +35,14 @@ |
||
| 35 | 35 | $tokenInfo = $auth0->decodeJWT($accessToken); |
| 36 | 36 | $user = $this->auth0Repository->getUserByDecodedJWT($tokenInfo); |
| 37 | 37 | if (!$user) { |
| 38 | - return response()->json(["message" => "Unauthorized user"], 401); |
|
| 38 | + return response()->json([ "message" => "Unauthorized user" ], 401); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | \Auth::login($user); |
| 42 | 42 | } catch (InvalidTokenException $e) { |
| 43 | - return response()->json(["message" => $e->getMessage()], 401); |
|
| 43 | + return response()->json([ "message" => $e->getMessage() ], 401); |
|
| 44 | 44 | } catch (CoreException $e) { |
| 45 | - return response()->json(["message" => $e->getMessage()], 401); |
|
| 45 | + return response()->json([ "message" => $e->getMessage() ], 401); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | return $next($request); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | | |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -Route::get('/blabla', function (Request $request) { |
|
| 16 | +Route::get('/blabla', function(Request $request) { |
|
| 17 | 17 | return response()->json('welcome to blabla the api'); |
| 18 | 18 | }); |
| 19 | 19 | |