with('client')->get()->sortBy('client.abbreviation'); } #[Computed] public function contacts() { if (!$this->invoice_id) { return collect(); } $invoice = Invoice::find($this->invoice_id); return $invoice?->client?->contacts ?? collect(); } public function updatedInvoiceId(): void { $this->contact_id = null; // Reset when invoice changes } public function mount(?int $invoice_id = null): void { $this->invoice_id = $invoice_id; $this->payment_date = now()->local()->format('Y-m-d'); } public function save() { $this->validate(); Payment::create([ 'invoice_id' => $this->invoice_id, 'contact_id'=> $this->contact_id, 'payment_date' => $this->payment_date, 'status' => $this->status, 'payment_method' => $this->payment_method, 'reference' => $this->reference, 'amount' => $this->amount, 'notes' => $this->notes, ]); $this->reset(); Flux::modal('create-payment')->close(); $this->dispatch('payment-created'); } }; ?>
Create Payment
Record Payment @foreach ($this->invoices as $invoice) @endforeach @foreach($this->contacts as $contact) {{ $contact->full_name }} @endforeach @foreach(PaymentMethod::cases() as $method) {{ $method->label() }} @endforeach Save Payment