<?php
 namespace App\EventHooks\Ticket; use App\EventHooks\HookEvent; use App\Models\Ticket; class TicketMerged extends HookEvent { public const HOOK = 'TicketMerge'; public function mergedTicketIds(): array { $ids = $this->get('mergedTicketIds', []); return is_array($ids) ? array_values(array_map('intval', $ids)) : []; } public function masterTicketId(): ?int { $id = $this->get('masterTicketId'); return $id ? (int) $id : null; } public function targetTicket(): ?Ticket { $id = $this->masterTicketId(); return $id ? Ticket::find($id) : null; } public function sourceTickets() { $ids = $this->mergedTicketIds(); return $ids ? Ticket::whereIn('id', $ids)->get() : collect(); } } 