Laravel broadcast channels.php, update object for all users?

281 views Asked by At

The default solution for broadcasting is to update something only for that one user but I have in place tasks, and if a user does some updates then I want that everybody is updated who has open this task.

Default behaviour for user is with user id:

Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
    return (int) $user->id === (int) $id;
});

What I tried is:

Broadcast::channel('channel-task-update.{taskId}', function ($user, $taskId) {
// QUESTION: For me it's not clear what to do here just to update this tasks for anyone who has open this task?
    // return (int) $user->id === (int) $id;
});
0

There are 0 answers