修复:channels.php 移除 int 类型提示,改用强转比较防兼容性问题

int $id 类型提示在某些 PHP 版本下对字符串参数可能失败,
统一改为 (int) 强转比较,与 App.Models.User.{id} 写法一致。
This commit is contained in:
2026-03-01 01:54:19 +08:00
parent 7bae5e56ff
commit 5a7d1565e5
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -29,6 +29,6 @@ Broadcast::channel('room.{roomId}', function ($user, $roomId) {
// 用户私有频道鉴权(好友通知:FriendAdded / FriendRemoved / BannerNotification
// 使用数字 ID 命名频道,避免中文用户名导致 Pusher 频道名验证失败。
Broadcast::channel('user.{id}', function ($user, int $id) {
return (int) $user->id === $id;
Broadcast::channel('user.{id}', function ($user, $id) {
return (int) $user->id === (int) $id;
});