multiplex user notifications over a single private channel
This commit is contained in:
1 parent
9b70b09173
commit
9fd72c6ea4
2 files changed
+3
-3
No files matched your search
@@ -52,9 +52,7 @@ class UserController extends Controller
|
||||
$admins->pluck('id')->toArray()
|
||||
);
|
||||
|
||||
Log::info('Broadcasting UserCreated event', ['user_id' => $user->id]);
|
||||
broadcast(new UserCreated($user));
|
||||
Log::info('Event broadcasted');
|
||||
|
||||
return response()->json(['message' => 'User created successfully']);
|
||||
}
|
||||
|
||||
+3
-1
@@ -7,4 +7,6 @@ Broadcast::channel('users.registration', function ($user) {
|
||||
return in_array($user->role, [1, 2]);
|
||||
});
|
||||
|
||||
|
||||
Broadcast::channel('user.{id}', function ($user, $id) {
|
||||
return (int) $user->id === (int) $id;
|
||||
});
|
||||
Reference in new issue
Block a user