srmklive /
chargify
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Srmklive\Chargify\Providers; |
||
| 4 | |||
| 5 | /* |
||
| 6 | * Class ChargifyServiceProvider |
||
| 7 | * @package Srmklive\Chargify |
||
| 8 | */ |
||
| 9 | |||
| 10 | use Illuminate\Support\ServiceProvider; |
||
| 11 | use Srmklive\Chargify\Services\ChargifyClient; |
||
| 12 | |||
| 13 | class ChargifyServiceProvider extends ServiceProvider |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * Indicates if loading of the provider is deferred. |
||
| 17 | * |
||
| 18 | * @var bool |
||
| 19 | */ |
||
| 20 | protected $defer = false; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * Bootstrap the application events. |
||
| 24 | * |
||
| 25 | * @return void |
||
| 26 | */ |
||
| 27 | public function boot() |
||
| 28 | { |
||
| 29 | // Publish config files |
||
| 30 | $this->publishes([ |
||
| 31 | __DIR__.'/../../config/config.php' => config_path('chargify.php'), |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 32 | ]); |
||
| 33 | } |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Register the service provider. |
||
| 37 | * |
||
| 38 | * @return void |
||
| 39 | */ |
||
| 40 | public function register() |
||
| 41 | { |
||
| 42 | $this->registerPayPal(); |
||
| 43 | |||
| 44 | $this->mergeConfig(); |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Register the application bindings. |
||
| 49 | * |
||
| 50 | * @return void |
||
| 51 | */ |
||
| 52 | private function registerPayPal() |
||
| 53 | { |
||
| 54 | $this->app->singleton('chargify', static function () { |
||
| 55 | return new ChargifyClient(); |
||
| 56 | }); |
||
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * Merges user's and paypal's configs. |
||
| 61 | * |
||
| 62 | * @return void |
||
| 63 | */ |
||
| 64 | private function mergeConfig() |
||
| 65 | { |
||
| 66 | $this->mergeConfigFrom( |
||
| 67 | __DIR__.'/../../config/config.php', |
||
| 68 | 'chargify' |
||
| 69 | ); |
||
| 70 | } |
||
| 71 | } |
||
| 72 |