I am doing a notification tracking by following a simple example from the internet. Unfortunately, so far, I've managed to make it work for only one user. When I open two users, the message from A to B works, but from B to A does not work. Can someone help me?
channels.php
Broadcast::channel('App.User.{id}', function ($user, $id) {
return (int) $user->id === (int) $id;
});
bootstrap.js
window.Pusher = require('pusher-js');
import Echo from "laravel-echo";
window.Echo = new Echo({
broadcaster: 'pusher',
key: 'some-key',
cluster: 'mt1',
forceTLS: true
});
global.js
var urlChannel = 'App.User.' + $('#user_logado_id').val();
window.Echo.private(urlChannel)
.notification((notification) => {
addNotificacao(notification);
});
Send notification to user.
$user->notify(new NotificacaoPadrao($param));
I would like notifications to be sent to all users.