added assets into stream
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Customer;
|
||||
|
||||
class WalletBroadcastService
|
||||
{
|
||||
public function broadcastForCustomer(int $customerId, ?int $ownerType = null): void
|
||||
{
|
||||
$stream = app(PriceStreamService::class);
|
||||
if (! $stream->isEnabled() || $customerId <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($ownerType === null || $ownerType <= 0) {
|
||||
$ownerType = (int) Customer::query()->whereKey($customerId)->value('type');
|
||||
}
|
||||
|
||||
if ($ownerType <= 0) {
|
||||
$ownerType = 2;
|
||||
}
|
||||
|
||||
$payload = app(AssetSummaryService::class)->buildForCustomer($customerId, $ownerType);
|
||||
$stream->publishForCustomer($customerId, 'assets', $payload);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user