coolify/routes/channels.php

25 lines
746 B
PHP
Raw Normal View History

2023-03-17 14:33:48 +00:00
<?php
/*
|--------------------------------------------------------------------------
| Broadcast Channels
|--------------------------------------------------------------------------
|
| Here you may register all of the event broadcasting channels that your
| application supports. The given channel authorization callbacks are
| used to check if an authenticated user can listen to the channel.
|
*/
2023-12-04 19:47:32 +00:00
use App\Models\User;
use Illuminate\Support\Facades\Auth;
2023-12-04 19:47:32 +00:00
use Illuminate\Support\Facades\Broadcast;
Broadcast::channel('team.{teamId}', function (User $user, int $teamId) {
2025-01-07 13:52:08 +00:00
return (bool) $user->teams->pluck('id')->contains($teamId);
2023-12-04 19:47:32 +00:00
});
Broadcast::channel('user.{userId}', function (User $user) {
2025-01-07 13:52:08 +00:00
return $user->id === Auth::id();
});