Loheide-eu-mitarbeiterplatt.../app/Providers/AppServiceProvider.php
Friederich Loheide 029dbd243d Rückmeldungen, Hintergrundaufgaben, Systemzustand und Web-Installer
- Rückmeldungen an den Hersteller (docs/specs/feedback.md): Fehlerbericht und
  Funktionswunsch, nur freigeschaltete Wege, Idempotency-Key je Meldung,
  Warteschlange mit höchstens fünf Versuchen, 422 am Feld, 429 mit Wartezeit,
  404 blendet den Weg aus, Referenznummer und „Meine Rückmeldungen“,
  sichtbare technische Angaben und Datenschutzhinweis über dem Absendeknopf
- Hintergrundaufgaben ohne Dauerprozess: Cron, Web-Cron (/cron/{token}) oder
  Pseudo-Cron nach dem Seitenaufruf; Queue in kurzen Häppchen
- Seite „Systemzustand“ mit Voraussetzungen, Grenzen, Betrieb, Sicherheit und
  Anleitung für den Cronjob
- Web-Installer (Systemprüfung → Datenbank → Administrator), legt .env und
  Anwendungsschlüssel selbst an, arbeitet vor der Einrichtung ohne Datenbank
- Datenbank-Benachrichtigungen im Admin-Bereich

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-26 06:11:09 +00:00

58 lines
2.1 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace App\Providers;
use App\Models\User;
use App\Support\Avatars;
use App\Support\BackgroundTasks;
use App\Support\Branding;
use App\Support\Installation;
use App\Support\License\LicenseStore;
use App\Support\Navigation;
use App\Support\QuickLinks;
use App\Support\Settings;
use App\Support\Update\InstalledVersion;
use App\Support\Update\MaintenanceFlag;
use App\Support\Update\UpdateProgress;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\ServiceProvider;
use Illuminate\Validation\Rules\Password;
class AppServiceProvider extends ServiceProvider
{
public function register(): void
{
// Frisch hochgeladen: .env und Schlüssel anlegen; bis zur Einrichtung ohne Datenbank
// für Sitzungen, Cache und Queue auskommen (der Web-Installer braucht das).
if (! $this->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(Navigation::class);
$this->app->singleton(QuickLinks::class);
$this->app->singleton(LicenseStore::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
{
// N+1-Abfragen in Entwicklung und Tests sofort sichtbar machen (docs/PLAN.md, Performance).
Model::preventLazyLoading(! $this->app->isProduction());
// Vorläufig: Administratoren über is_admin – wird in Phase 2 durch Rollen ersetzt.
Gate::define('admin', fn (User $user) => $user->is_admin && $user->is_active);
Password::defaults(fn () => Password::min(10)->letters()->numbers());
}
}