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\Application;
|
|
|
|
use App\Models\User;
|
|
|
|
use Illuminate\Support\Facades\Broadcast;
|
|
|
|
|
2023-12-11 09:23:10 +00:00
|
|
|
Broadcast::channel('team.{teamId}', function (User $user, int $teamId) {
|
2023-12-04 19:47:32 +00:00
|
|
|
if ($user->teams->pluck('id')->contains($teamId)) {
|
|
|
|
return true;
|
|
|
|
}
|
2024-06-10 20:43:34 +00:00
|
|
|
|
2023-12-04 19:47:32 +00:00
|
|
|
return false;
|
|
|
|
});
|
2023-12-11 09:23:10 +00:00
|
|
|
|
|
|
|
Broadcast::channel('user.{userId}', function (User $user) {
|
|
|
|
if ($user->id === auth()->user()->id) {
|
|
|
|
return true;
|
|
|
|
}
|
2024-06-10 20:43:34 +00:00
|
|
|
|
2023-12-11 09:23:10 +00:00
|
|
|
return false;
|
|
|
|
});
|