]> git.localhorst.tv Git - alttp.git/blobdiff - app/Events/TournamentChanged.php
lock tournaments
[alttp.git] / app / Events / TournamentChanged.php
diff --git a/app/Events/TournamentChanged.php b/app/Events/TournamentChanged.php
new file mode 100644 (file)
index 0000000..4a06f96
--- /dev/null
@@ -0,0 +1,40 @@
+<?php
+
+namespace App\Events;
+
+use App\Models\Tournament;
+use Illuminate\Broadcasting\Channel;
+use Illuminate\Broadcasting\InteractsWithSockets;
+use Illuminate\Broadcasting\PresenceChannel;
+use Illuminate\Broadcasting\PrivateChannel;
+use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
+use Illuminate\Foundation\Events\Dispatchable;
+use Illuminate\Queue\SerializesModels;
+
+class TournamentChanged implements ShouldBroadcast
+{
+       use Dispatchable, InteractsWithSockets, SerializesModels;
+
+       /**
+        * Create a new event instance.
+        *
+        * @return void
+        */
+       public function __construct(Tournament $tournament)
+       {
+               $this->tournament = $tournament;
+       }
+
+       /**
+        * Get the channels the event should broadcast on.
+        *
+        * @return \Illuminate\Broadcasting\Channel|array
+        */
+       public function broadcastOn()
+       {
+               return new Channel('Tournament.'.$this->tournament->id);
+       }
+
+       public $tournament;
+
+}