X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/7b6c88f17c595f3b0d88fe383827794b83dba3e7..refs/pull/2515/head:/app/Providers/AppServiceProvider.php diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index f214c9141..1c6180a1f 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -1,10 +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'); + } + + // Custom blade view directives + Blade::directive('icon', function ($expression) { + return ""; }); + // Allow longer string lengths after upgrade to utf8mb4 + 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); } /** @@ -30,6 +58,8 @@ 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')); + }); } }