]> git.localhorst.tv Git - alttp.git/blobdiff - app/Events/RoundAdded.php
listen to round updates
[alttp.git] / app / Events / RoundAdded.php
diff --git a/app/Events/RoundAdded.php b/app/Events/RoundAdded.php
new file mode 100644 (file)
index 0000000..a1b8787
--- /dev/null
@@ -0,0 +1,40 @@
+<?php
+
+namespace App\Events;
+
+use App\Models\Round;
+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 RoundAdded implements ShouldBroadcast
+{
+       use Dispatchable, InteractsWithSockets, SerializesModels;
+
+       /**
+        * Create a new event instance.
+        *
+        * @return void
+        */
+       public function __construct(Round $round)
+       {
+               $this->round = $round;
+       }
+
+       /**
+        * Get the channels the event should broadcast on.
+        *
+        * @return \Illuminate\Broadcasting\Channel|array
+        */
+       public function broadcastOn()
+       {
+               return new PrivateChannel('Tournament.'.$this->round->tournament_id);
+       }
+
+       public $round;
+
+}