]> git.localhorst.tv Git - alttp.git/blob - routes/channels.php
remove debug output
[alttp.git] / routes / channels.php
1 <?php
2
3 use App\Models\Tournament;
4 use Illuminate\Support\Facades\Broadcast;
5
6 /*
7 |--------------------------------------------------------------------------
8 | Broadcast Channels
9 |--------------------------------------------------------------------------
10 |
11 | Here you may register all of the event broadcasting channels that your
12 | application supports. The given channel authorization callbacks are
13 | used to check if an authenticated user can listen to the channel.
14 |
15 */
16
17 Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
18         return (int) $user->id === (int) $id;
19 });
20
21 Broadcast::channel('App.Control', function ($user) {
22         return true;
23 });
24
25 Broadcast::channel('Protocol.{id}', function ($user, $id) {
26         $tournament = Tournament::findOrFail($id);
27         return $user->can('viewProtocol', $tournament);
28 });
29
30 Broadcast::channel('Tournament.{id}', function ($user, $id) {
31         $tournament = Tournament::findOrFail($id);
32         return true;
33 });