app->runningUnitTests()) { Installation::prepareEnvironment(); } if (! Installation::isInstalled()) { config(['session.driver' => 'file', 'cache.default' => 'file', 'queue.default' => 'sync']); } $this->app->singleton(Settings::class); $this->app->singleton(Branding::class); $this->app->singleton(Avatars::class); $this->app->singleton(QuickLinks::class); $this->app->singleton(LicenseStore::class); $this->app->singleton(Permissions::class); $this->app->singleton(BackgroundTasks::class); $this->app->singleton(InstalledVersion::class); $this->app->singleton(UpdateProgress::class); $this->app->singleton(MaintenanceFlag::class); } public function boot(): void { CoreWidgets::register($this->app->make(Widgets::class)); // N+1-Abfragen in Entwicklung und Tests sofort sichtbar machen (docs/PLAN.md, Performance). Model::preventLazyLoading(! $this->app->isProduction()); // Rechte aus Rollen (App\Support\Abilities) entscheidet das Rechtesystem – Administration // hat sie alle. Alles andere (z. B. „delete“ auf einem Modell) entscheiden die Policies, // damit Regeln wie „Systemrollen nie löschen“ auch für Administratoren gelten. Gate::before(function (User $user, string $ability, array $arguments) { if (! $user->is_active) { return false; } if (! $this->app->make(Abilities::class)->exists($ability)) { return null; } [$type, $id] = PermissionResource::from($arguments); return $user->permissions()->can($ability, $type, $id); }); Password::defaults(fn () => Password::min(10)->letters()->numbers()); } }