Phase 0: Fundament für Inhaus
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m14s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 1m12s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 1m7s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 1m19s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m32s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m22s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 1m32s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m35s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m7s

- Laravel 13 mit Filament 5 (Admin), Inertia 3 + Vue 3 + Vuetify 4 (Material 3)
- Anmeldung über Fortify (Login, Passwort vergessen/ändern), keine Selbstregistrierung
- Profil mit Profilbild (WebP in festen Größen), Personenseiten, Header mit Avatar-Menü
- Material-3-Farbschema aus der Primärfarbe, hell/dunkel/System pro Person
- Basis-Branding (Portalname, Logo, Primärfarbe) im Admin unter „Erscheinungsbild“
- Benutzerverwaltung im Admin, Zugang vorläufig über is_admin
- vendor/ (ohne Dev-Pakete) und Frontend-Build mitversioniert, Dev-Pakete in vendor-dev/
- PHPUnit-Tests gegen MySQL/MariaDB, Forgejo-CI-Matrix, Docker-Entwicklungsumgebung
- VERSION, CHANGELOG.md und CONTRIBUTING.md mit Release-Ablauf

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-25 20:35:30 +00:00
parent 7197eaebf2
commit 9c0f8de791
15771 changed files with 1564103 additions and 5 deletions

View file

@ -0,0 +1,225 @@
<?php
namespace Filament\Notifications\Livewire;
use Carbon\CarbonInterface;
use Filament\Actions\Action;
use Filament\Actions\Concerns\InteractsWithActions;
use Filament\Actions\Contracts\HasActions;
use Filament\Notifications\Notification;
use Filament\Schemas\Concerns\InteractsWithSchemas;
use Filament\Schemas\Contracts\HasSchemas;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Contracts\Pagination\Paginator;
use Illuminate\Contracts\View\View;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Notifications\DatabaseNotification;
use Illuminate\Notifications\DatabaseNotificationCollection;
use Illuminate\Support\Str;
use Livewire\Attributes\On;
use Livewire\Component;
use Livewire\WithPagination;
class DatabaseNotifications extends Component implements HasActions, HasSchemas
{
use InteractsWithActions;
use InteractsWithSchemas;
use WithPagination;
public static bool $isPaginated = true;
public static ?string $trigger = null;
public static ?string $pollingInterval = '30s';
public static ?string $authGuard = null;
#[On('databaseNotificationsSent')]
public function refresh(): void {}
#[On('notificationClosed')]
public function removeNotification(string $id): void
{
if (! Str::isUuid($id)) {
return;
}
$this->getNotificationsQuery()
->where('id', $id)
->delete();
}
#[On('markedNotificationAsRead')]
public function markNotificationAsRead(string $id): void
{
if (! Str::isUuid($id)) {
return;
}
$this->getNotificationsQuery()
->where('id', $id)
->update(['read_at' => now()]);
}
#[On('markedNotificationAsUnread')]
public function markNotificationAsUnread(string $id): void
{
if (! Str::isUuid($id)) {
return;
}
$this->getNotificationsQuery()
->where('id', $id)
->update(['read_at' => null]);
}
public function clearNotifications(): void
{
$this->getNotificationsQuery()->delete();
}
public function markAllNotificationsAsRead(): void
{
$this->getUnreadNotificationsQuery()->update(['read_at' => now()]);
}
public function getNotifications(): DatabaseNotificationCollection | Paginator
{
if (! $this->isPaginated()) {
/** @phpstan-ignore-next-line */
return $this->getNotificationsQuery()->get();
}
return $this->getNotificationsQuery()->simplePaginate(50, pageName: 'database-notifications-page');
}
public function isPaginated(): bool
{
return static::$isPaginated;
}
public function getNotificationsQuery(): Builder | Relation
{
$user = $this->getUser();
if (! $user) {
abort(401);
}
/** @phpstan-ignore-next-line */
return $user->notifications()->where('data->format', 'filament');
}
public function getUnreadNotificationsQuery(): Builder | Relation
{
/** @phpstan-ignore-next-line */
return $this->getNotificationsQuery()->unread();
}
public function getUnreadNotificationsCount(): int
{
return $this->getUnreadNotificationsQuery()->count();
}
public function getPollingInterval(): ?string
{
return static::$pollingInterval;
}
public function getTrigger(): ?View
{
$viewPath = static::$trigger;
if (blank($viewPath)) {
return null;
}
return view($viewPath);
}
public function markAllNotificationsAsReadAction(): Action
{
return Action::make('markAllNotificationsAsRead')
->link()
->label(__('filament-notifications::database.modal.actions.mark_all_as_read.label'))
->action('markAllNotificationsAsRead');
}
public function clearNotificationsAction(): Action
{
return Action::make('clearNotifications')
->link()
->color('danger')
->label(__('filament-notifications::database.modal.actions.clear.label'))
->action('clearNotifications')
->close();
}
public function getUser(): Model | Authenticatable | null
{
return auth(static::$authGuard)->user();
}
public function getBroadcastChannel(): ?string
{
$user = $this->getUser();
if (! $user) {
return null;
}
if (method_exists($user, 'receivesBroadcastNotificationsOn')) {
return $user->receivesBroadcastNotificationsOn();
}
$userClass = str_replace('\\', '.', $user::class);
return "{$userClass}.{$user->getKey()}";
}
public function getNotification(DatabaseNotification $notification): Notification
{
return Notification::fromDatabase($notification)
->date($this->formatNotificationDate($notification->getAttributeValue('created_at')));
}
protected function formatNotificationDate(CarbonInterface $date): string
{
return $date->diffForHumans();
}
public static function trigger(?string $trigger): void
{
static::$trigger = $trigger;
}
public static function pollingInterval(?string $interval): void
{
static::$pollingInterval = $interval;
}
public static function authGuard(?string $guard): void
{
static::$authGuard = $guard;
}
/**
* @return array<string>
*/
public function queryStringHandlesPagination(): array
{
return [];
}
public function render(): View
{
return view('filament-notifications::database-notifications');
}
public function placeholder(): string
{
return '<div>' . $this->getTrigger()?->with(['unreadNotificationsCount' => $this->getUnreadNotificationsCount()])->render() . '</div>';
}
}

View file

@ -0,0 +1,130 @@
<?php
namespace Filament\Notifications\Livewire;
use Filament\Notifications\Collection;
use Filament\Notifications\Notification;
use Filament\Support\Enums\Alignment;
use Filament\Support\Enums\VerticalAlignment;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Contracts\View\View;
use Illuminate\Database\Eloquent\Model;
use Livewire\Attributes\On;
use Livewire\Component;
class Notifications extends Component
{
// Used to check if Livewire messages should trigger notification animations.
public bool $isFilamentNotificationsComponent = true;
public Collection $notifications;
public static Alignment $alignment = Alignment::Right;
public static VerticalAlignment $verticalAlignment = VerticalAlignment::Start;
public static ?string $authGuard = null;
public function mount(): void
{
$this->notifications = new Collection;
$this->pullNotificationsFromSession();
}
#[On('notificationsSent')]
public function pullNotificationsFromSession(): void
{
$notifications = session()->pull('filament.claimed_notifications')
?? session()->pull('filament.notifications')
?? [];
foreach ($notifications as $notification) {
$notification = Notification::fromArray($notification);
$this->pushNotification($notification);
}
}
/**
* @param array<string, mixed> $notification
*/
#[On('notificationSent')]
public function pushNotificationFromEvent(array $notification): void
{
$notification = Notification::fromArray($notification);
$this->pushNotification($notification);
}
#[On('notificationClosed')]
public function removeNotification(string $id): void
{
if (! $this->notifications->has($id)) {
return;
}
$this->notifications->forget($id);
}
/**
* @param array<string, mixed> $notification
*/
public function handleBroadcastNotification(array $notification): void
{
if (($notification['format'] ?? null) !== 'filament') {
return;
}
$this->pushNotification(Notification::fromArray($notification));
}
protected function pushNotification(Notification $notification): void
{
$this->notifications->put(
$notification->getId(),
$notification,
);
}
public function getUser(): Model | Authenticatable | null
{
return auth(static::$authGuard)->user();
}
public function getBroadcastChannel(): ?string
{
$user = $this->getUser();
if (! $user) {
return null;
}
if (method_exists($user, 'receivesBroadcastNotificationsOn')) {
return $user->receivesBroadcastNotificationsOn();
}
$userClass = str_replace('\\', '.', $user::class);
return "{$userClass}.{$user->getKey()}";
}
public static function alignment(Alignment $alignment): void
{
static::$alignment = $alignment;
}
public static function verticalAlignment(VerticalAlignment $alignment): void
{
static::$verticalAlignment = $alignment;
}
public static function authGuard(?string $guard): void
{
static::$authGuard = $guard;
}
public function render(): View
{
return view('filament-notifications::notifications');
}
}