toArray($notifiable); if (!$data) { return; } $user_id = $notifiable->user_id ?? $notifiable->id; $user = User::find($user_id); if (!in_array($data['type'] ?? '', ['info', 'success', 'warning', 'error'])) { $data['type'] = 'info'; } broadcast(new Users($user, $data['type'], $data)); } }