X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/ae95d0a239cf5f7406f6af7e2b25fd5be94a8ad0..refs/pull/3406/head:/app/Providers/AppServiceProvider.php diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 5be29756d..3c1212e32 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -1,10 +1,30 @@ "; + }); + + // Allow longer string lengths after upgrade to utf8mb4 + Schema::defaultStringLength(191); + + // Set morph-map for our relations to friendlier aliases + Relation::enforceMorphMap([ + 'bookshelf' => Bookshelf::class, + 'book' => Book::class, + 'chapter' => Chapter::class, + 'page' => Page::class, + ]); + + // View Composers + View::composer('entities.breadcrumbs', BreadcrumbsViewComposer::class); + + // Set paginator to use bootstrap-style pagination + Paginator::useBootstrap(); } /** @@ -25,6 +73,26 @@ class AppServiceProvider extends ServiceProvider */ public function register() { - // + $this->app->bind(HandlerInterface::class, function ($app) { + return $app->make(WhoopsBookStackPrettyHandler::class); + }); + + $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)); + }); + + $this->app->singleton(CspService::class, function ($app) { + return new CspService(); + }); + + $this->app->bind(HttpClientInterface::class, function ($app) { + return new Client([ + 'timeout' => 3, + ]); + }); } }