如何接收管理员的广播通知?

时间:2018-12-07 05:47:58

标签: php laravel pusher laravel-5.7 laravel-echo

我正在为管理员进行广播通知,并已在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

0 个答案:

没有答案