]> git.localhorst.tv Git - alttp.git/blob - app/Events/ProtocolAdded.php
better chat filters
[alttp.git] / app / Events / ProtocolAdded.php
1 <?php
2
3 namespace App\Events;
4
5 use App\Models\Protocol;
6 use Illuminate\Broadcasting\Channel;
7 use Illuminate\Broadcasting\InteractsWithSockets;
8 use Illuminate\Broadcasting\PresenceChannel;
9 use Illuminate\Broadcasting\PrivateChannel;
10 use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
11 use Illuminate\Foundation\Events\Dispatchable;
12 use Illuminate\Queue\SerializesModels;
13
14 class ProtocolAdded implements ShouldBroadcast
15 {
16         use Dispatchable, InteractsWithSockets, SerializesModels;
17
18         /**
19          * Create a new event instance.
20          *
21          * @return void
22          */
23         public function __construct(Protocol $protocol)
24         {
25                 $protocol->load('user');
26                 $this->protocol = $protocol;
27         }
28
29         /**
30          * Get the channels the event should broadcast on.
31          *
32          * @return \Illuminate\Broadcasting\Channel|array
33          */
34         public function broadcastOn()
35         {
36                 return new PrivateChannel('Protocol.'.$this->protocol->tournament_id);
37         }
38
39         public $protocol;
40
41 }