]> git.localhorst.tv Git - alttp.git/blobdiff - routes/channels.php
add up to 4 player support for zsr sync
[alttp.git] / routes / channels.php
index 5d451e1fae88c81c097aa55de6ff039a3cc0a1c3..b0a25526a12701f2f783d06a128c48433c7be02c 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 
+use App\Models\Channel;
+use App\Models\Tournament;
 use Illuminate\Support\Facades\Broadcast;
 
 /*
@@ -14,5 +16,24 @@ use Illuminate\Support\Facades\Broadcast;
 */
 
 Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
-    return (int) $user->id === (int) $id;
+       return (int) $user->id === (int) $id;
+});
+
+Broadcast::channel('App.Control', function ($user) {
+       return true;
+});
+
+Broadcast::channel('Channel.{id}', function ($user, $id) {
+       $channel = Channel::findOrFail($id);
+       return $user->can('editRestream', $channel);
+});
+
+Broadcast::channel('Protocol.{id}', function ($user, $id) {
+       $tournament = Tournament::findOrFail($id);
+       return $user->can('viewProtocol', $tournament);
+});
+
+Broadcast::channel('Tournament.{id}', function ($user, $id) {
+       $tournament = Tournament::findOrFail($id);
+       return true;
 });