Termine im Portal bearbeiten (0.23.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m53s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m42s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m13s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m10s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 5m46s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 5m35s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 4m54s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 4m53s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m10s

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-27 07:56:48 +00:00
parent 80a0f20447
commit d7d09d6b9a
142 changed files with 917 additions and 315 deletions

View file

@ -3,6 +3,7 @@
namespace Inhaus\Plugins\Events;
use App\Dashboard\Widgets;
use App\Editorial\Editorial;
use App\Media\ImagePaths;
use App\Media\MediaUsages;
use App\Models\User;
@ -36,6 +37,24 @@ class EventsPlugin extends Plugin
], fn (callable $each) => Event::query()->chunkById(100, fn ($events) => $events->each($each)));
$usages->watch('events', Event::class, ['image_path', 'description_html', 'title', 'is_published']);
// Redaktion im Portal
$this->app->make(Editorial::class)->add('events', 'Termine', 'events::EditorialEvents', 30,
fn (User $user) => $user->can('events.manage'),
fn (User $user) => [
'events' => Event::query()->where(fn ($q) => $q->where('starts_at', '>=', now()->subDays(30))->orWhere('ends_at', '>=', now()))
->orderBy('starts_at')->limit(100)->get()
->map(fn (Event $event) => [
'id' => $event->id,
'title' => $event->title,
'starts_at' => $event->starts_at->toIso8601String(),
'all_day' => $event->all_day,
'location' => $event->location,
'is_published' => $event->is_published,
'is_past' => ($event->ends_at ?? $event->starts_at->copy()->endOfDay())->isPast(),
'edit_url' => route('events.edit', $event),
])->all(),
]);
$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);