Files
SAE-BUT2-backend/app/Events/EventParticipationCancelled.php
T

46 lines
1.0 KiB
PHP

<?php
namespace App\Events;
use App\Models\Event;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcastNow;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class EventParticipationCancelled implements ShouldBroadcastNow
{
use Dispatchable, InteractsWithSockets, SerializesModels;
public $userId;
public $event;
/**
* Create a new event instance.
*/
public function __construct($userId, Event $event)
{
$this->userId = $userId;
$this->event = $event;
}
/**
* Get the channels the event should broadcast on.
*
* @return array<int, \Illuminate\Broadcasting\Channel>
*/
public function broadcastOn(): array
{
return [
new PrivateChannel('user.' . $this->userId),
];
}
public function broadcastAs()
{
return 'event.participation.cancelled';
}
}