【发布时间】:2021-02-24 23:34:02
【问题描述】:
我已经在我的 Laravel 8 应用上设置了一个带有 Pusher 和 Echo 的通知系统。它工作正常,我可以在 VanillaJS 中检索通知事件
window.Echo.private('App.Models.User.' + User.id)
.notification((notification) => {
if (notification.type === 'App\\Notifications\\JobLiked') {
let count = document.getElementById('count');
let number = count.innerHTML;
number++;
count.innerHTML = number;
}
});
但现在我想使用 Livewire 监听器来触发我的功能,然后我设置:
public function getListeners()
{
return [
"echo-private:App.Models.User.{$this->authId},NotificationSent" => 'notifyNewJobLiked',
];
}
但似乎没有任何效果,我没有错误消息..你知道可能发生什么吗?
非常感谢! :)
【问题讨论】:
标签: laravel events echo pusher laravel-livewire