dealhub/routes/channels.php
2026-02-16 12:30:57 +05:30

14 lines
419 B
PHP

<?php
use App\Models\User;
use Illuminate\Support\Facades\Broadcast;
Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
return (int) $user->id === (int) $id;
});
Broadcast::channel('chat.{user1}.{user2}', function (User $user, int $user1, int $user2) {
// Only allow the user if their ID matches one of the two in the channel name
return $user->id === $user1 || $user->id === $user2;
});