Plugin-System; Neuigkeiten und Termine als mitgelieferte Plugins
- 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>
This commit is contained in:
parent
cc0020458f
commit
28ef1e4a20
155 changed files with 2762 additions and 573 deletions
|
|
@ -2,13 +2,14 @@
|
|||
|
||||
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\Navigation;
|
||||
use App\Support\QuickLinks;
|
||||
use App\Support\Settings;
|
||||
use App\Support\Update\InstalledVersion;
|
||||
|
|
@ -36,7 +37,6 @@ class AppServiceProvider extends ServiceProvider
|
|||
$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);
|
||||
|
|
@ -47,11 +47,14 @@ class AppServiceProvider extends ServiceProvider
|
|||
|
||||
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());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace App\Providers\Filament;
|
|||
|
||||
use App\Filament\AvatarProviders\InitialsAvatarProvider;
|
||||
use App\Filament\Pages\Feedback;
|
||||
use App\Plugins\PluginManager;
|
||||
use App\Support\Branding;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Http\Middleware\Authenticate;
|
||||
|
|
@ -29,7 +30,7 @@ class AdminPanelProvider extends PanelProvider
|
|||
{
|
||||
// Keine eigene Filament-Anmeldung: das Admin-Backend nutzt den Portal-Login
|
||||
// (und damit später auch Entra ID). Nicht angemeldete Personen landen auf /login.
|
||||
return $panel
|
||||
$panel = $panel
|
||||
->default()
|
||||
->id('admin')
|
||||
->path('admin')
|
||||
|
|
@ -76,5 +77,16 @@ class AdminPanelProvider extends PanelProvider
|
|||
->authMiddleware([
|
||||
Authenticate::class,
|
||||
]);
|
||||
|
||||
// Admin-Seiten der aktiven Plugins (src/Filament/{Resources,Pages,Widgets}).
|
||||
foreach (app(PluginManager::class)->filamentDiscovery() as $discovery) {
|
||||
match ($discovery['type']) {
|
||||
'Resources' => $panel->discoverResources(in: $discovery['path'], for: $discovery['namespace']),
|
||||
'Pages' => $panel->discoverPages(in: $discovery['path'], for: $discovery['namespace']),
|
||||
'Widgets' => $panel->discoverWidgets(in: $discovery['path'], for: $discovery['namespace']),
|
||||
};
|
||||
}
|
||||
|
||||
return $panel;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
35
app/Providers/PluginServiceProvider.php
Normal file
35
app/Providers/PluginServiceProvider.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Dashboard\Widgets;
|
||||
use App\Plugins\Hooks;
|
||||
use App\Plugins\PluginManager;
|
||||
use App\Plugins\PluginState;
|
||||
use App\Support\Abilities;
|
||||
use App\Support\Navigation;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
/**
|
||||
* Lädt die Plugins. Muss vor den Panel-Providern registriert sein, damit
|
||||
* Plugins ihre Admin-Seiten beitragen können.
|
||||
*/
|
||||
class PluginServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->singleton(Hooks::class);
|
||||
$this->app->singleton(PluginState::class);
|
||||
$this->app->singleton(PluginManager::class);
|
||||
$this->app->singleton(Navigation::class);
|
||||
$this->app->singleton(Widgets::class);
|
||||
$this->app->singleton(Abilities::class);
|
||||
|
||||
$this->app->make(PluginManager::class)->registerAll();
|
||||
}
|
||||
|
||||
public function boot(): void
|
||||
{
|
||||
$this->app->make(PluginManager::class)->bootAll();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue