1 | <?php |
||
7 | class YourMembershipServiceProvider extends ServiceProvider |
||
8 | { |
||
9 | /** |
||
10 | * Package Config Name |
||
11 | * @var string |
||
12 | */ |
||
13 | private $packageName = 'yourmembership'; |
||
14 | /** |
||
15 | * Package Config Path |
||
16 | * @var string |
||
17 | */ |
||
18 | private $packageConfigPath = __DIR__.'/config/yourmembership.php'; |
||
19 | /** |
||
20 | * Indicates if loading of the provider is deferred. |
||
21 | * |
||
22 | * @var bool |
||
23 | */ |
||
24 | protected $defer = true; |
||
25 | |||
26 | /** |
||
27 | * Register the service provider. |
||
28 | * |
||
29 | * @return void |
||
30 | */ |
||
31 | public function register() |
||
32 | { |
||
33 | $this->mergeConfigFrom( |
||
34 | $this->packageConfigPath, $this->packageName |
||
35 | ); |
||
36 | |||
37 | $this->app->bind(YourMembershipClient::class, function ($app, $parameters) { |
||
38 | $guzzleClient = app(\GuzzleHttp\Client::class, [$app['config']['yourmembership']['guzzle-client']]); |
||
39 | return new YourMembershipClient($guzzleClient, $parameters[0], $parameters[1]); |
||
40 | }); |
||
41 | } |
||
42 | /** |
||
43 | * Boot the service provider. |
||
44 | * |
||
45 | * @return void |
||
46 | */ |
||
47 | public function boot() |
||
53 | |||
54 | /** |
||
55 | * Get the services provided by the provider. |
||
56 | * |
||
57 | * @return array |
||
58 | */ |
||
59 | public function provides() |
||
63 | } |
||
64 |