X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/f0d914abbf728e52ec12aa1348a259b5327878c6..refs/pull/2902/head:/app/Providers/AppServiceProvider.php diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index ef3ee6c48..145a7645b 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -1,9 +1,24 @@ -getMimeType(), $imageMimes); - }); + // Set root URL + $appUrl = config('app.url'); + if ($appUrl) { + $isHttps = (strpos($appUrl, 'https://') === 0); + URL::forceRootUrl($appUrl); + URL::forceScheme($isHttps ? 'https' : 'http'); + } - \Blade::directive('icon', function($expression) { + // Custom blade view directives + Blade::directive('icon', function ($expression) { return ""; }); // Allow longer string lengths after upgrade to utf8mb4 - \Schema::defaultStringLength(191); + Schema::defaultStringLength(191); + + // Set morph-map due to namespace changes + Relation::morphMap([ + 'BookStack\\Bookshelf' => Bookshelf::class, + 'BookStack\\Book' => Book::class, + 'BookStack\\Chapter' => Chapter::class, + 'BookStack\\Page' => Page::class, + ]); + + // View Composers + View::composer('entities.breadcrumbs', BreadcrumbsViewComposer::class); } /** @@ -35,8 +64,12 @@ class AppServiceProvider extends ServiceProvider */ public function register() { - $this->app->singleton(SettingService::class, function($app) { - return new SettingService($app->make(Setting::class), $app->make('Illuminate\Contracts\Cache\Repository')); + $this->app->singleton(SettingService::class, function ($app) { + return new SettingService($app->make(Setting::class), $app->make(Repository::class)); + }); + + $this->app->singleton(SocialAuthService::class, function ($app) { + return new SocialAuthService($app->make(SocialiteFactory::class), $app->make(LoginService::class)); }); } }