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; });