- Plugins nach WordPress-Prinzip: plugin.json-Manifest mit Versions- und Abhängigkeitsprüfung, eigenes PSR-4-Autoloading, register()/boot(), activate()/deactivate()/uninstall(), Migrationen, Routen und Views je Plugin - plugins-core/ (mitgeliefert, aktiv bis zur Deaktivierung) und plugins/ (Kunden-Plugins, geschützt vor Updates, inaktiv bis zur Aktivierung) - Zustand in storage/app/plugins.json – Laden ohne Datenbankabfrage - Wiederherstellungsmodus: Ausnahmen und Fatal Errors beim Laden deaktivieren das Plugin, das Portal bleibt erreichbar - Hooks (Actions/Filter mit Prioritäten) und Registries für Navigation, Startseiten-Kacheln, Rechte und Admin-Seiten (Filament-Discovery) - Admin-Seite „Plugins“: aktivieren, deaktivieren, per ZIP installieren (ZIP-Slip-Schutz), löschen mit oder ohne Daten; abschaltbar per INHAUS_DISALLOW_FILE_MODS - Startseite komplett aus Kacheln; Plugin-Seiten als „slug::Seite“ - Version 0.3.0 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
61 lines
2.2 KiB
PHP
61 lines
2.2 KiB
PHP
<?php
|
||
|
||
namespace App\Providers;
|
||
|
||
use App\Dashboard\CoreWidgets;
|
||
use App\Dashboard\Widgets;
|
||
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\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(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
|
||
{
|
||
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());
|
||
|
||
// 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);
|
||
Gate::before(fn (User $user) => $user->is_admin && $user->is_active ? true : null);
|
||
|
||
Password::defaults(fn () => Password::min(10)->letters()->numbers());
|
||
}
|
||
}
|