@@ -12,7 +12,7 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - Schema::create(config('plugin.tenant'), function (\Illuminate\Database\Schema\Blueprint $blueprint) { |
|
| 15 | + Schema::create(config('plugin.tenant'), function(\Illuminate\Database\Schema\Blueprint $blueprint) { |
|
| 16 | 16 | $blueprint->increments('id'); |
| 17 | 17 | $blueprint->string('addon_key'); |
| 18 | 18 | $blueprint->string('client_key', 36); |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | ]); |
| 48 | 48 | |
| 49 | 49 | // If tenant is trashed we need "un-delete" it because add-on installing implies enabling |
| 50 | - if($tenant->trashed()) { |
|
| 50 | + if ($tenant->trashed()) { |
|
| 51 | 51 | $tenant->restore(); |
| 52 | 52 | } |
| 53 | 53 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | protected function loadRoutes() |
| 66 | 66 | { |
| 67 | - if(config('plugin.loadRoutes')) { |
|
| 67 | + if (config('plugin.loadRoutes')) { |
|
| 68 | 68 | $this->loadRoutesFrom(__DIR__ . '/Http/routes.php'); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | protected function loadConsoleCommands() |
| 86 | 86 | { |
| 87 | - if(!$this->app->runningInConsole()) { |
|
| 87 | + if (!$this->app->runningInConsole()) { |
|
| 88 | 88 | return; |
| 89 | 89 | } |
| 90 | 90 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | protected function registerJWTGuard() |
| 117 | 117 | { |
| 118 | - Auth::extend('jwt', function (Application $app, $name, array $config) |
|
| 118 | + Auth::extend('jwt', function(Application $app, $name, array $config) |
|
| 119 | 119 | { |
| 120 | 120 | return $app->makeWith(JWTGuard::class, [ |
| 121 | 121 | 'provider' => Auth::createUserProvider($config['provider']), |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | ->findWhere(['client_key' => $attributes['client_key']]) |
| 55 | 55 | ->first(); |
| 56 | 56 | |
| 57 | - if(!$model) { |
|
| 57 | + if (!$model) { |
|
| 58 | 58 | return $this->repository->create($attributes); |
| 59 | 59 | } |
| 60 | 60 | |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | */ |
| 102 | 102 | public function findByClientKeyOrFail($clientKey, $withTrashed = true) |
| 103 | 103 | { |
| 104 | - if($tenant = $this->findByClientKey($clientKey, $withTrashed)) { |
|
| 104 | + if ($tenant = $this->findByClientKey($clientKey, $withTrashed)) { |
|
| 105 | 105 | return $tenant; |
| 106 | 106 | } |
| 107 | 107 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | */ |
| 128 | 128 | public function delete($id) |
| 129 | 129 | { |
| 130 | - if(config('plugin.safeDelete')) { |
|
| 130 | + if (config('plugin.safeDelete')) { |
|
| 131 | 131 | return $this->repository->delete($id); |
| 132 | 132 | } |
| 133 | 133 | |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | public function makeDummy($id) |
| 155 | 155 | { |
| 156 | - if(!$this->repository->findById($id)) { |
|
| 156 | + if (!$this->repository->findById($id)) { |
|
| 157 | 157 | throw new NotFoundHttpException(); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | { |
| 21 | 21 | $parts = explode('.', $token); |
| 22 | 22 | |
| 23 | - if(count($parts) !== 3) { |
|
| 23 | + if (count($parts) !== 3) { |
|
| 24 | 24 | return null; |
| 25 | 25 | } |
| 26 | 26 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | $validator = Validator::make(['value' => $id], ['value' => Rule::in($choices)]); |
| 73 | 73 | |
| 74 | - if($validator->fails()) { |
|
| 74 | + if ($validator->fails()) { |
|
| 75 | 75 | return $this->error('Invalid ID provided'); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | { |
| 93 | 93 | $tenants = collect($tenants->toArray()); |
| 94 | 94 | |
| 95 | - return $tenants->map(function ($tenant) use ($attributes) { |
|
| 95 | + return $tenants->map(function($tenant) use ($attributes) { |
|
| 96 | 96 | |
| 97 | 97 | // Make the client key shorter for displaying |
| 98 | 98 | $tenant['client_key'] = substr($tenant['client_key'], -22); |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | */ |
| 60 | 60 | protected function createDummyTenant() |
| 61 | 61 | { |
| 62 | - if(!Schema::hasTable($tableName = config('plugin.tenant'))) { |
|
| 62 | + if (!Schema::hasTable($tableName = config('plugin.tenant'))) { |
|
| 63 | 63 | throw new \Exception('Table ' . $tableName . ' should be exist. Please, run migrations'); |
| 64 | 64 | } |
| 65 | 65 | |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | // Of course you can provide it if you want. Otherwise request will be signed automatically |
| 44 | 44 | $jwt = request('jwt', request()->header('Authorization')); |
| 45 | 45 | |
| 46 | - if(app()->isLocal() && !$jwt) { |
|
| 47 | - if(!$tenant = $this->tenantService->dummy()) { |
|
| 46 | + if (app()->isLocal() && !$jwt) { |
|
| 47 | + if (!$tenant = $this->tenantService->dummy()) { |
|
| 48 | 48 | throw new \Illuminate\Validation\UnauthorizedException( |
| 49 | 49 | 'You should have at least one dummy tenant to get it working locally' |
| 50 | 50 | ); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // Authenticate user |
| 64 | - if(!Auth::attempt()) { |
|
| 64 | + if (!Auth::attempt()) { |
|
| 65 | 65 | throw new \Illuminate\Validation\UnauthorizedException(); |
| 66 | 66 | } |
| 67 | 67 | |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -Route::group(['namespace' => 'AtlassianConnectCore\Http\Controllers'], function () { |
|
| 3 | +Route::group(['namespace' => 'AtlassianConnectCore\Http\Controllers'], function() { |
|
| 4 | 4 | Route::get('atlassian-connect.json', 'TenantController@descriptor')->name('descriptor'); |
| 5 | 5 | |
| 6 | 6 | Route::post('installed', 'TenantController@installed')->name('installed'); |
| 7 | 7 | Route::post('disabled', 'TenantController@disabled')->name('disabled'); |
| 8 | 8 | |
| 9 | - Route::group(['middleware' => 'jwt'], function () { |
|
| 9 | + Route::group(['middleware' => 'jwt'], function() { |
|
| 10 | 10 | Route::post('enabled', 'TenantController@enabled')->name('enabled'); |
| 11 | 11 | Route::post('uninstalled', 'TenantController@uninstalled')->name('uninstalled'); |
| 12 | 12 | |