initialize($weldLogData, $document, $sheet, $currentRow, $settings); $lotNumbers = array_filter([ $weldLogData['welding_materials_1_lot_no'] ?? '', $weldLogData['welding_materials_2_lot_no'] ?? '', $weldLogData['welding_materials_3_lot_no'] ?? '' ]); $placeholderReplacer = new \App\Services\RegisterCreator\PlaceholderReplacer(); foreach ($lotNumbers as $lotNo) { $normalized = $this->normalizeSearchTerm($lotNo); $search = $this->searchFiles("storage/documents/{$document['path']}/*{$normalized}*.pdf"); $document['title2'] = $lotNo; $this->document = $document; $documentDate = $placeholderReplacer->getLatestDate($weldLogData, $this->registerColumnBased); $newRow = $this->addRowToExcel($search, $lotNo, $documentDate); if ($newRow > $currentRow) { $currentRow = $newRow; } } return $currentRow; } }