3 use App\Models\Channel;
4 use App\Models\Tournament;
5 use Illuminate\Support\Facades\Broadcast;
8 |--------------------------------------------------------------------------
10 |--------------------------------------------------------------------------
12 | Here you may register all of the event broadcasting channels that your
13 | application supports. The given channel authorization callbacks are
14 | used to check if an authenticated user can listen to the channel.
18 Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
19 return (int) $user->id === (int) $id;
22 Broadcast::channel('App.Control', function ($user) {
26 Broadcast::channel('Channel.{id}', function ($user, $id) {
27 $channel = Channel::findOrFail($id);
28 return $user->can('editRestream', $channel);
31 Broadcast::channel('Protocol.{id}', function ($user, $id) {
32 $tournament = Tournament::findOrFail($id);
33 return $user->can('viewProtocol', $tournament);
36 Broadcast::channel('Tournament.{id}', function ($user, $id) {
37 $tournament = Tournament::findOrFail($id);