getClientOriginalExtension()), $validImageExtensions); }); Validator::extend('no_double_extension', function ($attribute, $value, $parameters, $validator) { $uploadName = $value->getClientOriginalName(); return substr_count($uploadName, '.') < 2; }); Validator::extend('safe_url', function ($attribute, $value, $parameters, $validator) { $cleanLinkName = strtolower(trim($value)); $isJs = strpos($cleanLinkName, 'javascript:') === 0; $isData = strpos($cleanLinkName, 'data:') === 0; return !$isJs && !$isData; }); // Custom blade view directives Blade::directive('icon', function ($expression) { return ""; }); Blade::directive('exposeTranslations', function ($expression) { return "startPush('translations'); ?>" . "" . '' . "\n" . "" . 'stopPush(); ?>'; }); // 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); } /** * Register any application services. * * @return void */ public function register() { $this->app->singleton(SettingService::class, function ($app) { return new SettingService($app->make(Setting::class), $app->make('Illuminate\Contracts\Cache\Repository')); }); } }