123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- namespace App\Providers;
- use Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider;
- use Carbon\Carbon;
- use Illuminate\Support\ServiceProvider;
- use App\Services\ChuanglanSmsService;
- use App\Services\AliSmsService;
- class AppServiceProvider extends ServiceProvider
- {
- /**
- * Bootstrap any application services.
- *
- * @return void
- */
- public function boot()
- {
- Carbon::setLocale('zh');
- // 创蓝短信
- $this->app->singleton('ChuanglanSms', function ($app) {
- return new ChuanglanSmsService(
- Config('services.chuanglansms.default')
- );
- });
- $this->app->singleton('Sms253', function ($app) {
- return new ChuanglanSmsService(
- Config('services.chuanglansms.yingxiao')
- );
- });
- // 阿里云短信
- $this->app->singleton('AliSms', function ($app) {
- return new AliSmsService(
- Config('services.alisms.access_key_id'),
- Config('services.alisms.access_key_secret')
- );
- });
- }
- /**
- * Register any application services.
- *
- * @return void
- */
- public function register()
- {
- if ($this->app->environment() == 'local') {
- $this->app->register(IdeHelperServiceProvider::class);
- }
- }
- }
|