where('drawing_no', $lineListData->line_no) ->pluck('test_package_no') ->toArray(); // 2. Update test_packages where test_package_no matches the found ones if (!empty($testPackageNos)) { $result = db("test_packages") ->whereIn("test_package_number", $testPackageNos) ->update([ 'isolation' => $lineListData->external_finish_type ]); } else { $result = 0; } Log::info("Line List Isolation Sync completed", [ 'line_no' => $lineListData->line_no, 'external_finish_type' => $lineListData->external_finish_type, 'updated' => $result, ]); return [ 'success' => true, 'test_packages_updated' => $result, ]; } }