X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/f42d355fd74fc32ea62fd85e17de304e146ca9c3..refs/pull/2515/head:/app/Providers/AppServiceProvider.php diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 57e5c8ed5..1c6180a1f 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -1,9 +1,18 @@ 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('partials.breadcrumbs', BreadcrumbsViewComposer::class); } /**