multiplex user notifications over a single private channel
This commit is contained in:
@@ -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