<?php
 namespace App\EventHooks\Invoice; use App\EventHooks\HookEvent; use App\Models\Transaction; class TransactionAdded extends HookEvent { public const HOOK = 'AddTransaction'; public function transaction(): ?Transaction { $t = $this->get('transaction'); if ($t instanceof Transaction) { return $t; } $id = $this->get('transaction_id') ?? $this->get('id'); return $id ? Transaction::find($id) : null; } } 