+ // 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 "<?php echo icon($expression); ?>";
+ });
+
+ // 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();