From 693f4e0f6b5b1aa72d676ef34e428cdab119311c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Beganovi=C4=87?= Date: Tue, 17 Sep 2024 18:57:51 +0200 Subject: [PATCH] broadcast event on invoice.paid --- app/Events/Invoice/InvoiceWasPaid.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/app/Events/Invoice/InvoiceWasPaid.php b/app/Events/Invoice/InvoiceWasPaid.php index 34c574275a86..6f845592ce9b 100644 --- a/app/Events/Invoice/InvoiceWasPaid.php +++ b/app/Events/Invoice/InvoiceWasPaid.php @@ -1,4 +1,5 @@ company = $company; $this->event_vars = $event_vars; } + + public function broadcastOn(): array + { + return [ + // @todo: make sure this is PrivateChannel once we have auth configured. + + new Channel( + name: $this->company->company_key . '_invoices', + ), + ]; + } + + public function broadcastAs(): string + { + return 'invoice.paid'; + } }