where("test_package_no", $testPackageNo)->get(); $logTypes = array_keys(log_test_types()); foreach($allJoints as $joint) { $jointArray = (array)$joint; foreach($logTypes as $logType) { if (strpos(strtolower($docPath), $logType) !== false) { $reportNoPrefix = ($logType == "pmi") ? "no_of_testing_report" : $logType . "_report"; if (!empty($jointArray[$reportNoPrefix])) { $reportNo = $jointArray[$reportNoPrefix]; $docDate = $jointArray[$logType . '_test_date']; $search = $this->alternativeGlob("storage/documents/{$docPath}/{$reportNo}.pdf"); $document['title2'] = $reportNo; // Translation $translationKey = $logType . "_register_title"; // Note: If using helper e2(), ensure it's available or pass via settings. // Assuming e2 is global helper. $document['title4'] = e2($translationKey); $this->addRow($search, $document, $folder, $reportNo, $docDate, $rowNo, $sheet, $currentRow, $override); } } } } // Update row_no in settings passed by reference if needed, but simple return of new currentRow is standard. // However, we also need to return new rowNo count or just the new currentRow index. // The Abstract class addRow increments currentRow and rowNo by reference. // But since rowNo is primitive, it won't persist back to caller unless we return it or use object. // TpCreatorService expects new currentRow. // We actually need to return how many rows added or the new current Row. return $currentRow; } }