/** * @return $this */ public function init() { $config = Arr::collapse([$this->loadIlluminateConfiguration(), $this->loadFiledConfiguration()]); $this->application->instance('env', 'production'); $this->application->instance('config', new Repository($config)); $this->application->registerConfiguredProviders(); $this->application->singleton(HttpKernelContract::class, HttpKernel::class); $this->application->singleton(ConsoleKernelContract::class, ConsoleKernel::class); $this->application->singleton(ExceptionHandler::class, Handler::class); if ($this->application->isInstalled()) { $this->application->register(ThemeServiceProvider::class); $this->application->register(MenuServiceProvider::class); $this->application->register(CategoryServiceProvider::class); $this->application->register(ArticleServiceProvider::class); $this->application->register(HttpServiceProvider::class); $this->application->register(PageServiceProvider::class); $this->application->register(AdminServiceProvider::class); } else { $this->application->register(InstallServiceProvider::class); } return $this; }