Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m18s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m21s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 2m40s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 2m34s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 3m8s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 3m6s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 2m43s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 2m47s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m1s
- Formulare: Felder fest aus dem Profil (nicht änderbar, Server setzt den Profilwert ein), Hinweis bei fehlender Profilangabe - Geburtstage (optionales Plugin, standardmäßig aus): Tag und Monat freiwillig im Profil, Kachel, Liste /geburtstage, Pagebuilder-Block, Glückwunsch am eigenen Geburtstag; Sichtbarkeit alle/Abteilung/Standort - Startseite: Kacheln je Bereich sortieren und ausblenden; eigene Kacheln (Bild mit Link, Text, Hinweis) mit Zeitraum und Zielgruppe - Kern: optionale mitgelieferte Plugins, Startseitenbereich „top“, Profilabschnitte für Plugins, Kachel-Bezeichnungen Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
40 lines
1.6 KiB
PHP
40 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace Inhaus\Plugins\Events;
|
|
|
|
use App\Dashboard\Widgets;
|
|
use App\Models\User;
|
|
use App\Pagebuilder\Blocks;
|
|
use App\Pagebuilder\BlockType;
|
|
use App\Pagebuilder\Field;
|
|
use App\Plugins\Plugin;
|
|
use App\Support\Abilities;
|
|
use App\Support\Navigation;
|
|
use Illuminate\Support\Facades\Gate;
|
|
use Inhaus\Plugins\Events\Http\Resources\EventResource;
|
|
use Inhaus\Plugins\Events\Models\Event;
|
|
use Inhaus\Plugins\Events\Policies\EventPolicy;
|
|
|
|
class EventsPlugin extends Plugin
|
|
{
|
|
public function register(): void
|
|
{
|
|
$this->app->make(Navigation::class)->add('events', 'Termine', '/termine', active: 'events.*', sort: 30);
|
|
$this->app->make(Abilities::class)->define('events.manage', 'Termine verwalten', 'Termine');
|
|
Gate::policy(Event::class, EventPolicy::class);
|
|
|
|
$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);
|
|
|
|
$this->app->make(Blocks::class)->add(BlockType::make('events.upcoming', 'Termine', 'calendar-days', 'dynamic', 'events::UpcomingEvents')
|
|
->description('Die nächsten Termine.')
|
|
->fields([
|
|
Field::text('title', 'Überschrift', 150, 'Termine'),
|
|
Field::number('count', 'Anzahl', 1, 12, 4),
|
|
])
|
|
->resolveUsing(fn (array $data, ?User $user) => [
|
|
'events' => EventResource::collection(Event::query()->upcoming()->visibleTo($user)->limit($data['count'])->get())->resolve(),
|
|
]));
|
|
}
|
|
}
|