coolify/routes/channels.php
Andras Bacsai 3ffd3fc819 fix: channels
feat: database backup is realtime now
2023-12-11 10:23:10 +01:00

31 lines
826 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\Application;
use App\Models\User;
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()->user()->id) {
return true;
}
return false;
});