- 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>
47 lines
1.7 KiB
PHP
47 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Dashboard;
|
|
|
|
use App\Http\Resources\PersonResource;
|
|
use App\Models\User;
|
|
use App\Support\QuickLinks;
|
|
|
|
/**
|
|
* Kacheln des Kerns. Plugins ergänzen weitere über App\Dashboard\Widgets.
|
|
*/
|
|
class CoreWidgets
|
|
{
|
|
public static function register(Widgets $widgets): void
|
|
{
|
|
$widgets->add('core.greeting', 'core::Greeting', 'aside', sort: 0, props: fn (User $user) => [
|
|
'profile' => [
|
|
'job_title' => $user->job_title,
|
|
'department' => $user->department,
|
|
'location' => $user->location,
|
|
'avatar_url' => $user->avatarUrl(256),
|
|
],
|
|
], mobileSort: 0);
|
|
|
|
$widgets->add('core.quick-links', 'core::QuickLinks', 'main', sort: 10, props: fn () => [
|
|
'links' => app(QuickLinks::class)->all(),
|
|
], mobileSort: 40);
|
|
|
|
$widgets->add('core.new-colleagues', 'core::NewColleagues', 'main', sort: 90, props: function (User $user) {
|
|
$people = User::query()
|
|
->active()
|
|
->whereKeyNot($user->getKey())
|
|
->where('created_at', '>=', now()->subDays(90))
|
|
->latest()
|
|
->limit(6)
|
|
->get();
|
|
|
|
return $people->isEmpty() ? null : ['people' => PersonResource::collection($people)->resolve()];
|
|
}, mobileSort: 60);
|
|
|
|
$widgets->add('core.profile-incomplete', 'core::ProfileIncomplete', 'aside', sort: 50, props: fn (User $user) => $user->avatar_path && $user->job_title ? null : [], mobileSort: 70);
|
|
|
|
$widgets->add('core.people-search', 'core::PeopleSearch', 'aside', sort: 60, props: fn () => [
|
|
'count' => User::query()->active()->count(),
|
|
], mobileSort: 80);
|
|
}
|
|
}
|