@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('typeform_auth_codes', function (Blueprint $table) { |
|
| 16 | + Schema::create('typeform_auth_codes', function(Blueprint $table) { |
|
| 17 | 17 | $table->bigIncrements('id'); |
| 18 | 18 | $table->bigInteger('user_id'); |
| 19 | 19 | $table->text('auth_code'); |
@@ -15,20 +15,20 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | public function register() |
| 17 | 17 | { |
| 18 | - $this->publishes([__DIR__ . '/../config/config.php' => config_path('typeform_service.php'), |
|
| 18 | + $this->publishes([__DIR__.'/../config/config.php' => config_path('typeform_service.php'), |
|
| 19 | 19 | ], 'config'); |
| 20 | 20 | $this->mergeConfigFrom( |
| 21 | - __DIR__ . '/../config/config.php', 'typeform_service' |
|
| 21 | + __DIR__.'/../config/config.php', 'typeform_service' |
|
| 22 | 22 | ); |
| 23 | 23 | |
| 24 | - $this->publishes([__DIR__ . '/../public/services/typeform' => public_path('services/typeform')]); |
|
| 25 | - $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); |
|
| 24 | + $this->publishes([__DIR__.'/../public/services/typeform' => public_path('services/typeform')]); |
|
| 25 | + $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); |
|
| 26 | 26 | |
| 27 | 27 | $this->publishes([ |
| 28 | - __DIR__ . '/../resources/views' => resource_path('views/vendor/typeformservice'), |
|
| 28 | + __DIR__.'/../resources/views' => resource_path('views/vendor/typeformservice'), |
|
| 29 | 29 | ], 'views'); |
| 30 | 30 | |
| 31 | - $this->loadViewsFrom(__DIR__ . '/../resources/views', 'typeformservice'); |
|
| 31 | + $this->loadViewsFrom(__DIR__.'/../resources/views', 'typeformservice'); |
|
| 32 | 32 | |
| 33 | 33 | } |
| 34 | 34 | |
@@ -50,12 +50,12 @@ discard block |
||
| 50 | 50 | Route::prefix($this->app['config']->get('typeform_service.url_prefix')) |
| 51 | 51 | ->middleware(['web', 'auth']) |
| 52 | 52 | ->namespace('BristolSU\Service\Typeform\Http\Controllers') |
| 53 | - ->group(__DIR__ . '/../routes/web.php'); |
|
| 53 | + ->group(__DIR__.'/../routes/web.php'); |
|
| 54 | 54 | |
| 55 | - Route::prefix('api')->middleware(['api', 'auth'])->group(function () { |
|
| 55 | + Route::prefix('api')->middleware(['api', 'auth'])->group(function() { |
|
| 56 | 56 | Route::prefix($this->app['config']->get('typeform_service.url_prefix')) |
| 57 | 57 | ->namespace('BristolSU\Service\Typeform\Http\Controllers') |
| 58 | - ->group(__DIR__ . '/../routes/api.php'); |
|
| 58 | + ->group(__DIR__.'/../routes/api.php'); |
|
| 59 | 59 | }); |
| 60 | 60 | |
| 61 | 61 | JavaScriptFacade::put([ |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | public function registerGlobalScript($path) |
| 68 | 68 | { |
| 69 | - View::composer('bristolsu::base', function (\Illuminate\View\View $view) use ($path) { |
|
| 69 | + View::composer('bristolsu::base', function(\Illuminate\View\View $view) use ($path) { |
|
| 70 | 70 | $scripts = ($view->offsetExists('globalScripts') ? $view->offsetGet('globalScripts') : []); |
| 71 | 71 | $scripts[] = asset($path); |
| 72 | 72 | $view->with('globalScripts', $scripts); |
@@ -16,8 +16,8 @@ |
||
| 16 | 16 | public function request($method, $uri, array $options = []) |
| 17 | 17 | { |
| 18 | 18 | $options['base_uri'] = config('typeform_service.base_uri'); |
| 19 | - $headers = ((isset($options['headers']) && is_array($options['headers']))?$options['headers']:[]); |
|
| 20 | - $headers['Authorization'] = 'Bearer ' . $this->getSetting('api_key'); |
|
| 19 | + $headers = ((isset($options['headers']) && is_array($options['headers'])) ? $options['headers'] : []); |
|
| 20 | + $headers['Authorization'] = 'Bearer '.$this->getSetting('api_key'); |
|
| 21 | 21 | $options['headers'] = $headers; |
| 22 | 22 | return $this->client->request($method, $uri, $options); |
| 23 | 23 | } |
@@ -19,8 +19,8 @@ discard block |
||
| 19 | 19 | public function request($method, $uri, array $options = []) |
| 20 | 20 | { |
| 21 | 21 | $options['base_uri'] = config('typeform_service.base_uri'); |
| 22 | - $headers = ((isset($options['headers']) && is_array($options['headers']))?$options['headers']:[]); |
|
| 23 | - $headers['Authorization'] = 'Bearer ' . $this->getAccessToken(); |
|
| 22 | + $headers = ((isset($options['headers']) && is_array($options['headers'])) ? $options['headers'] : []); |
|
| 23 | + $headers['Authorization'] = 'Bearer '.$this->getAccessToken(); |
|
| 24 | 24 | $options['headers'] = $headers; |
| 25 | 25 | return $this->client->request($method, $uri, $options); |
| 26 | 26 | } |
@@ -51,10 +51,10 @@ discard block |
||
| 51 | 51 | private function getAccessToken($refreshable = true): string |
| 52 | 52 | { |
| 53 | 53 | $authCode = AuthModel::findOrFail($this->getSetting('auth_code_id')); |
| 54 | - if($authCode->isValid()) { |
|
| 54 | + if ($authCode->isValid()) { |
|
| 55 | 55 | return $authCode->auth_code; |
| 56 | 56 | } |
| 57 | - if($refreshable && $this->refreshAccessToken($authCode)) { |
|
| 57 | + if ($refreshable && $this->refreshAccessToken($authCode)) { |
|
| 58 | 58 | return $this->getAccessToken(false); |
| 59 | 59 | } else { |
| 60 | 60 | // TODO Throw special error to send email to people |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | 'code' => $request->input('code'), |
| 20 | 20 | 'client_id' => config('typeform_service.client_id'), |
| 21 | 21 | 'client_secret' => config('typeform_service.client_secret'), |
| 22 | - 'redirect_uri' => config('app.url') . '/_connector/typeform/redirect' |
|
| 22 | + 'redirect_uri' => config('app.url').'/_connector/typeform/redirect' |
|
| 23 | 23 | ], |
| 24 | 24 | ]); |
| 25 | 25 | $token = json_decode($response->getBody()->getContents(), true); |