| 1 | <?php |
||
| 7 | class PhpSmsServiceProvider extends ServiceProvider |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * bootstrap |
||
| 11 | */ |
||
| 12 | public function boot() |
||
| 13 | { |
||
| 14 | //publish config files |
||
| 15 | $this->publishes([ |
||
| 16 | __DIR__ . '/../config/phpsms.php' => config_path('phpsms.php'), |
||
| 17 | ], 'config'); |
||
| 18 | } |
||
| 19 | |||
| 20 | /** |
||
| 21 | * register service provider |
||
| 22 | */ |
||
| 23 | public function register() |
||
| 24 | { |
||
| 25 | //merge configs |
||
| 26 | $this->mergeConfigFrom( |
||
| 27 | __DIR__ . '/../config/phpsms.php', 'phpsms' |
||
| 28 | ); |
||
| 29 | |||
| 30 | Sms::scheme(config('phpsms.scheme', []); |
||
|
|
|||
| 31 | Sms::config(config('phpsms.agents', [])); |
||
| 32 | |||
| 33 | $this->app->singleton('PhpSms', function () { |
||
| 34 | return new Sms(false); |
||
| 35 | }); |
||
| 36 | } |
||
| 37 | } |
||
| 38 |