我正在为管理员进行广播通知,并已在Pusher服务器上进行广播通知,通知显示在Pusher服务器中,但我无法在控制台上打印通知 这是我的app.js代码
Echo.private('App.Model.Admin.Admin.' + userId)
.notification((notification) => {
console.log(notification.type);
});
这是我的channel.php
代码
Broadcast::channel('App.Model.Admin.Admin.{admin}',function ($user, Admin $admin){
return $user->id === $admin->id;
});
这是我的BroadcastServiceProvider.php
代码
public function boot()
{
Broadcast::routes(['middleware' => ['auth:admin']]);
/*
* Authenticate the user's personal channel...
*/
Broadcast::channel('App.Model.Admin.Admin.*', function ($user, $userId) {
return $user->id === $userId;
});
}
这是我在推送服务器上的频道名称
private-App.Model.Admin.Admin.1