mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 19:24:40 -04:00
broadcast event on invoice.paid
This commit is contained in:
parent
f5d9ca5174
commit
693f4e0f6b
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoice Ninja (https://invoiceninja.com).
|
* Invoice Ninja (https://invoiceninja.com).
|
||||||
*
|
*
|
||||||
@ -14,12 +15,14 @@ namespace App\Events\Invoice;
|
|||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\Invoice;
|
use App\Models\Invoice;
|
||||||
use App\Models\Payment;
|
use App\Models\Payment;
|
||||||
|
use Illuminate\Broadcasting\Channel;
|
||||||
|
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class InvoiceWasPaid.
|
* Class InvoiceWasPaid.
|
||||||
*/
|
*/
|
||||||
class InvoiceWasPaid
|
class InvoiceWasPaid implements ShouldBroadcast
|
||||||
{
|
{
|
||||||
use SerializesModels;
|
use SerializesModels;
|
||||||
|
|
||||||
@ -48,4 +51,20 @@ class InvoiceWasPaid
|
|||||||
$this->company = $company;
|
$this->company = $company;
|
||||||
$this->event_vars = $event_vars;
|
$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';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user