Files
portal-api/app/Events/OrderProvisioned.php

45 lines
1.1 KiB
PHP

<?php
namespace App\Events;
use Illuminate\Broadcasting\Channel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class OrderProvisioned implements ShouldBroadcast
{
use Dispatchable, SerializesModels;
public function __construct(
public readonly int $orderId,
public readonly string $orderNum,
public readonly string $customerName,
public readonly string $vmId,
public readonly bool $success,
public readonly string $message,
) {}
public function broadcastOn(): Channel
{
return new Channel('admin-notifications');
}
public function broadcastAs(): string
{
return 'order.provisioned';
}
public function broadcastWith(): array
{
return [
'order_id' => $this->orderId,
'order_num' => $this->orderNum,
'customer_name' => $this->customerName,
'vm_id' => $this->vmId,
'success' => $this->success,
'message' => $this->message,
];
}
}