<?php
 namespace App\EventHooks\Invoice; use App\EventHooks\HookEvent; use App\Models\Invoice; class InvoiceTotalUpdated extends HookEvent { public const HOOK = 'UpdateInvoiceTotal'; public function invoice(): ?Invoice { $i = $this->get('invoice'); if ($i instanceof Invoice) { return $i; } $id = $this->get('invoice_id'); return $id ? Invoice::find($id) : null; } } 