managers()->without($this); if ($recipients->isEmpty()) return; $newNotification = new Notification($notificationData); foreach ($recipients as $otherUser) { try { $notifications = $otherUser->notifications()->isNotEmpty() ? Yaml::decode($otherUser->notifications()->value()) : []; $notifications[] = $newNotification->toArray(); $otherUser->update([ 'notifications' => $notifications ]); } catch (\Throwable $th) { error_log("Notification error for user " . $otherUser->email() . ": " . $th->getMessage()); throw new Exception("Error updating notifications: " . $th->getMessage() . ' line ' . $th->getLine(), 1); } } };