<?php

namespace App\Providers;

use App\Notification\DingDingRobot;
use Illuminate\Pagination\Paginator;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //
        Schema::defaultStringLength(191);
        // Laravel 5.7兼容的分页设置
        Paginator::defaultView('vendor.pagination.bootstrap-4');
        Paginator::defaultSimpleView('vendor.pagination.simple-bootstrap-4');
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        $this->app->singleton(DingDingRobot::class, function () {
            return new DingDingRobot(env('DINGDING_ACCESS_TOKEN'), env('DINGDING_SECRET'));
        });
    }
}
