1 | <?php |
||
2 | |||
3 | namespace Sarahman\OauthTokensClient; |
||
4 | |||
5 | use GuzzleHttp\Client; |
||
6 | use Illuminate\Support\ServiceProvider; |
||
7 | |||
8 | class ServiceProviderForLaravelRecent extends ServiceProvider |
||
9 | { |
||
10 | public function boot() |
||
11 | { |
||
12 | // Publishes the configuration file |
||
13 | $this->publishes([ |
||
14 | __DIR__ . '/config/config.php' => config_path('oauth-tokens-client.php'), |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
15 | ], 'config'); |
||
16 | } |
||
17 | |||
18 | public function register() |
||
19 | { |
||
20 | // Merges default configuration |
||
21 | $this->mergeConfigFrom(__DIR__ . '/config/config.php', 'oauth-tokens-client'); |
||
22 | |||
23 | $this->app->bind('oauth-tokens-client.service', function ($app) { |
||
24 | $oauthTokenConfig = $app->make('config')->get('oauth-tokens-client'); |
||
25 | |||
26 | return new OAuthClient( |
||
27 | new Client, |
||
28 | $app['cache.store'], |
||
29 | $oauthTokenConfig['OAUTH_CREDENTIAL'], |
||
30 | $oauthTokenConfig['TOKEN_PREFIXES'], |
||
31 | $oauthTokenConfig['LOCK_KEY'] |
||
32 | ); |
||
33 | }); |
||
34 | } |
||
35 | } |
||
36 |