] * * @since [v3.0] * * @return void */ public function boot(UrlGenerator $url) { /** * This is a workaround for proxies/reverse proxies that don't always pass the proper headers. * * Here, we check if the APP_URL starts with https://, which we should always honor, * regardless of how well the proxy or network is configured. * * We'll force the https scheme if the APP_URL starts with https://, or if APP_FORCE_TLS is set to true. */ if ((strpos(env('APP_URL'), 'https://') === 0) || (env('APP_FORCE_TLS'))) { $url->forceScheme('https'); } // TODO - isn't it somehow 'gauche' to check the environment directly; shouldn't we be using config() somehow? if (! env('APP_ALLOW_INSECURE_HOSTS')) { // unless you set APP_ALLOW_INSECURE_HOSTS, you should PROHIBIT forging domain parts of URL via Host: headers $url_parts = parse_url(config('app.url')); if ($url_parts && array_key_exists('scheme', $url_parts) && array_key_exists('host', $url_parts)) { // check for the *required* parts of a bare-minimum URL URL::forceRootUrl(config('app.url')); } else { Log::error('Your APP_URL in your .env is misconfigured - it is: '.config('app.url').'. Many things will work strangely unless you fix it.'); } } Paginator::useBootstrap(); Schema::defaultStringLength(191); Accessory::observe(AccessoryObserver::class); Asset::observe(AssetObserver::class); AssetModel::observe(AssetModelObserver::class); Component::observe(ComponentObserver::class); Consumable::observe(ConsumableObserver::class); License::observe(LicenseObserver::class); Location::observe(LocationObserver::class); Maintenance::observe(MaintenanceObserver::class); Setting::observe(SettingObserver::class); User::observe(UserObserver::class); } /** * Register any application services. * * @return void */ public function register() { if ($this->app->environment('local')) { $this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class); $this->app->register(TelescopeServiceProvider::class); } // Only load rollbar if there is a rollbar key and the app is in production if (($this->app->environment('production')) && (config('logging.channels.rollbar.access_token'))) { $this->app->register(RollbarServiceProvider::class); } $this->app->singleton('ArieTimmerman\Laravel\SCIMServer\SCIMConfig', SnipeSCIMConfig::class); // this overrides the default SCIM configuration with our own } }