users()->not($this) as $otherUser) { try { $notifications = $otherUser->notifications()->isNotEmpty() ? Yaml::decode($otherUser->notifications()->value()) : []; if (!isset($notifications[$group])) { $notifications[$group] = []; } $notifications[$group][$item->id()] = $item->toArray(); $otherUser->update([ 'notifications' => $notifications ]); } catch (\Throwable $th) { throw new Exception("Error updating notifications: " . $th->getMessage() . ' line ' . $th->getLine(), 1); } } };