mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-04 10:42:23 +00:00
28 lines
763 B
PHP
28 lines
763 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\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, int $userId) {
|
|
return (int) $user->id === $userId;
|
|
});
|