app->singleton( AdminAuthService::class, function () { $guard = Auth::guard('backend'); return new AdminAuthService($guard); } ); $this->app->singleton( ProductDirectory::class, fn () => new EloquentProductDirectory() ); $this->app->singleton( RecipeDirectory::class, fn () => new EloquentRecipeDirectory() ); $this->requestMacro(); } public function boot(): void { $this->dateSetup(); $this->laravelGlobalSetup(); } private function laravelGlobalSetup(): void { Model::shouldBeStrict(app()->environment('local')); Vite::useCspNonce(); URL::forceScheme('https'); } private function dateSetup(): void { foreach ([\LC_TIME, \LC_MESSAGES, \LC_COLLATE, \LC_CTYPE, \LC_MONETARY] as $constant) { setlocale( $constant, sprintf( '%s_%s.UTF-8', Config::string('app.locale'), strtoupper(Config::string('app.locale')) ) ); } Date::setLocale(Config::string('app.locale')); Date::setFallbackLocale(Config::string('app.fallback_locale')); } private function requestMacro(): void { Request::macro('pagination', function (int $defaultPageSize = 25): Pagination { if ($this->has('offset') || $this->has('limit')) { return Pagination::ofOffsetAndLimit( $this->integer('offset', 0), $this->integer('limit', $defaultPageSize) ); } return Pagination::ofPage( $this->integer('page', 1), $this->integer( 'per_page', // * Default laravel paginator name $this->integer('pagination', $defaultPageSize) ) ); }); } }