<?php
 namespace App\EventHooks\Catalog; use App\EventHooks\HookEvent; use App\Models\Post; class AnnouncementAdded extends HookEvent { public const HOOK = 'AnnouncementAdd'; public function announcement(): ?Post { $a = $this->get('announcement'); if ($a instanceof Post) { return $a; } $id = $this->get('announcement_id') ?? $this->get('announcementid'); return $id ? Post::find($id) : null; } } 