<?php
 namespace App\EventHooks\Invoice; use App\EventHooks\HookEvent; use App\Models\Invoice; use App\Models\Quote; class QuoteAccepted extends HookEvent { public const HOOK = 'AcceptQuote'; public function quote(): ?Quote { $q = $this->get('quote'); if ($q instanceof Quote) { return $q; } $id = $this->get('quote_id'); return $id ? Quote::find($id) : null; } 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; } } 