/** * Bootstrap any application services. * * @return void */ public function boot() { $this->configurePublicFilesRoutes(); if (self::$alreadyLoaded) { return; //< to prevent 2 different providers overwrite each other } $basePath = '/' . trim($this->cmfConfig->url_prefix(), '/'); if (empty($_SERVER['REQUEST_URI']) || starts_with($_SERVER['REQUEST_URI'], $basePath)) { $this->cmfConfig->replaceConfigInstance(CmfConfig::class, $this->cmfConfig); $this->loadConfigs(); // alter auth config $this->configureAuth(); // alter session config $this->configureSession($basePath); // custom configurations $this->configure(); $this->configureViewsLoading(); $this->configureTranslationsLoading(); $this->configurePublishes(); $this->setLocale(); $this->loadRoutes(); $this->includeFiles(); $this->storeConfigsInLaravelContainer(); self::$alreadyLoaded = true; } else { $this->whenConfigsShouldNotBeLoaded(); } }