<?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);
        }
    }
}
