Feed in der Mitarbeiter-App (0.54.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Failing after 15m6s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Failing after 15m58s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Failing after 15m42s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Failing after 15m21s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 1h1m41s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 1h2m13s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 23m20s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 23m33s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 1m17s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m57s

Feed-Registry mit Anbietern (Neu im Team, Neuigkeiten, Termine, Umfragen),
Schnellaktionen je nach Rechten, Nachladen über /feed.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-30 14:27:23 +00:00
parent ab76b65aff
commit 8acc0cfd8b
152 changed files with 950 additions and 361 deletions

View file

@ -5,6 +5,7 @@ namespace Inhaus\Plugins\Events;
use App\Dashboard\Widgets;
use App\Digest\Digest;
use App\Editorial\Editorial;
use App\Feed\Feed;
use App\Media\ImagePaths;
use App\Media\MediaUsages;
use App\Models\User;
@ -15,6 +16,7 @@ use App\Plugins\Plugin;
use App\Search\GlobalSearch;
use App\Support\Abilities;
use App\Support\Navigation;
use Carbon\CarbonImmutable;
use Illuminate\Support\Facades\Gate;
use Inhaus\Plugins\Events\Http\Resources\EventResource;
use Inhaus\Plugins\Events\Models\Event;
@ -71,6 +73,29 @@ class EventsPlugin extends Plugin
$this->app->make(Editorial::class)->meta('events', icon: 'calendar-days',
create: fn (User $user) => $user->can('events.manage') ? ['label' => 'Neuer Termin', 'href' => route('events.create')] : null);
// Feed: neu eingetragene, noch anstehende Termine
if (class_exists(Feed::class)) {
$this->app->make(Feed::class)->add('events', fn (User $user, ?CarbonImmutable $before, int $limit) => Event::query()
->upcoming()->visibleTo($user)->with('author')
->where('created_at', '>=', now()->subDays(60))
->when($before, fn ($query) => $query->where('created_at', '<', $before))
->reorder()->latest('created_at')->limit($limit)->get()
->map(fn (Event $event) => [
'id' => 'event-'.$event->id,
'kind' => 'event',
'time' => $event->created_at,
'actor' => Feed::person($event->author),
'action' => 'hat einen Termin eingetragen',
'badge' => 'Neuer Termin',
'title' => $event->title,
'text' => $event->starts_at->translatedFormat('l, j. F Y, H:i').' Uhr'.($event->location ? ' · '.$event->location : ''),
'image_url' => $event->imageUrl('large'),
'url' => route('events.show', $event),
'date' => $event->starts_at->toIso8601String(),
'cta' => ['label' => 'Ansehen', 'url' => route('events.show', $event)],
]));
}
$this->app->make(Widgets::class)->add('events.upcoming', 'events::Upcoming', 'aside', sort: 20, props: fn (User $user) => [
'events' => EventResource::collection(Event::query()->upcoming()->visibleTo($user)->limit(4)->get())->resolve(),
], label: 'Termine', mobileSort: 30);