registerProviders(); } /** * 启动时加载 * * @return void */ public function boot() { $this->bootConfig(); $this->bootArch(); } /** * 注册第三方服务 * * @return void */ protected function registerProviders() { $this->app->singleton(\Illuminate\Contracts\Debug\ExceptionHandler::class, \Dipper\Foundation\Exceptions\Handler::class); $this->app->singleton(\Illuminate\Contracts\Console\Kernel::class, \App\Console\Kernel::class); $this->app->singleton(\Illuminate\Contracts\Routing\ResponseFactory::class, \App\Core\ResponseFactory::class); // Redis $this->app->singleton('redis', function ($app) { return $app->loadComponent('database', 'Illuminate\Redis\RedisServiceProvider', 'redis'); }); // Mongodb $this->app->register(\Jenssegers\Mongodb\MongodbServiceProvider::class); // JWT $this->app->register(\Dipper\JWTAuth\JWTAuthServiceProvider::class); // Image $this->app->register(\Intervention\Image\ImageServiceProviderLumen::class); // 拼音 $this->app->register(\Overtrue\LaravelPinyin\ServiceProvider::class); // SMS $this->app->singleton('sms', function ($app) { return $app->loadComponent('sms', \Dipper\Sms\SmsServiceProvider::class); }); // flashmessage $this->app->singleton('flashmessage', function ($app) { return $app->loadComponent('flashmessage', \Dipper\FlashMessage\FlashMessageServiceProvider::class); }); // excel $this->app->register(\Dipper\Excel\ExcelServiceProvider::class); // 全局代理 $this->app->singleton('dipper', function ($app) { return new Dipper(); }); } /** * 注册配置 * * @return void */ protected function bootConfig() { $this->app->configure('icon'); $this->app->configure('regex'); $this->app->configure('filter'); $this->app->configure('captcha'); $this->app->configure('cors'); } /** * 注册框架 * * @return void */ protected function bootArch() { $this->app->register(\Dipper\Foundation\ServiceProvider::class); } }