Files
coolify/routes/channels.php
Andras Bacsai 1fe4dd722b Revert "rector: arrrrr"
This reverts commit 16c0cd10d8.
2025-01-07 15:31:43 +01:00

33 lines
829 B
PHP

<?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.
|
*/
use App\Models\User;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Broadcast;
Broadcast::channel('team.{teamId}', function (User $user, int $teamId) {
if ($user->teams->pluck('id')->contains($teamId)) {
return true;
}
return false;
});
Broadcast::channel('user.{userId}', function (User $user) {
if ($user->id === Auth::id()) {
return true;
}
return false;
});