<?php
 namespace App\EventHooks\Invoice; use App\EventHooks\HookEvent; use App\Models\Transaction; class TransactionLogged extends HookEvent { public const HOOK = 'LogTransaction'; 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; } public function amount(): mixed { return $this->get('amount'); } public function gateway(): ?string { return $this->get('gateway'); } } 