lasthourcloud/app/Events/TestEvent.php

29 lines
640 B
PHP
Raw Normal View History

2023-12-05 10:17:52 +00:00
<?php
namespace App\Events;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class TestEvent implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
2024-06-10 20:43:34 +00:00
2023-12-05 14:19:54 +00:00
public $teamId;
2024-06-10 20:43:34 +00:00
2023-12-05 10:17:52 +00:00
public function __construct()
{
2023-12-05 14:19:54 +00:00
$this->teamId = auth()->user()->currentTeam()->id;
2023-12-05 10:17:52 +00:00
}
public function broadcastOn(): array
{
return [
new PrivateChannel("team.{$this->teamId}"),
2023-12-05 10:17:52 +00:00
];
}
}