]> git.localhorst.tv Git - alttp.git/blobdiff - routes/channels.php
more content variety
[alttp.git] / routes / channels.php
index 5d451e1fae88c81c097aa55de6ff039a3cc0a1c3..e93d25e9c284e4afa7c4c91876f6688e97133590 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 
+use App\Models\Tournament;
 use Illuminate\Support\Facades\Broadcast;
 
 /*
@@ -14,5 +15,19 @@ 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('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;
 });