Websocket events when updating recurring invoice prices
This commit is contained in:
parent
3b73c4bb05
commit
a960691f1a
|
|
@ -41,7 +41,7 @@ class DownloadAvailable implements ShouldBroadcast
|
|||
public function broadcastWith(): array
|
||||
{
|
||||
|
||||
ctrans('texts.document_download_subject');
|
||||
// ctrans('texts.document_download_subject');
|
||||
|
||||
return [
|
||||
'message' => $this->message,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2025. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://www.elastic.co/licensing/elastic-license
|
||||
*/
|
||||
|
||||
namespace App\Events\Socket;
|
||||
|
||||
use App\Models\User;
|
||||
use League\Fractal\Manager;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Broadcasting\PrivateChannel;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
use App\Utils\Traits\Invoice\Broadcasting\DefaultResourceBroadcast;
|
||||
|
||||
/**
|
||||
* Class RefetchEntity.
|
||||
*/
|
||||
class RefetchEntity implements ShouldBroadcast
|
||||
{
|
||||
use SerializesModels;
|
||||
use InteractsWithSockets;
|
||||
|
||||
public function __construct(public string $entity, public ?string $entity_id, public User $user)
|
||||
{
|
||||
}
|
||||
|
||||
public function broadcastOn()
|
||||
{
|
||||
return [
|
||||
new PrivateChannel("user-{$this->user->account->key}-{$this->user->id}"),
|
||||
];
|
||||
}
|
||||
|
||||
public function broadcastWith(): array
|
||||
{
|
||||
|
||||
return [
|
||||
'entity' => $this->entity,
|
||||
'entity_id' => $this->entity_id,
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -11,15 +11,16 @@
|
|||
|
||||
namespace App\Jobs\RecurringInvoice;
|
||||
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Company;
|
||||
use App\Models\RecurringInvoice;
|
||||
use App\Models\User;
|
||||
use App\Models\Company;
|
||||
use App\Libraries\MultiDB;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use App\Models\RecurringInvoice;
|
||||
use App\Events\Socket\RefetchEntity;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
class UpdateRecurring implements ShouldQueue
|
||||
{
|
||||
|
|
@ -58,6 +59,8 @@ class UpdateRecurring implements ShouldQueue
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
event(new RefetchEntity('recurring_invoices', null, $this->user));
|
||||
}
|
||||
|
||||
public function failed($exception = null)
|
||||
|
|
|
|||
Loading…
Reference in New Issue