whereIn("test_package_no", array_column($data, 'test_package_no'))->get(); $QABasePath = "storage/documents/004_QA"; $tpBasePath = "storage/documents/004_QA/0019_TP_Documentation"; $wqtrPath = "storage/documents/004_QA/0015_WQTR"; $naksPath = "storage/documents/003_Welding_Database/0001_Naks_Welder"; $jsrPath = "storage/documents/005_PTO/02_ЖСР"; $clearancePath = "storage/documents/004_QA/0010_Spool_NDT_Release_Check_List"; $test_package_numbers = []; foreach($weldLogs AS $weldLog) { $certificates = explode(",", $weldLog->certificate_no_1); if(!in_array($weldLog->test_package_no, $test_package_numbers)) { $test_package_numbers[] = $weldLog->test_package_no; } $isometric = $weldLog->iso_number; $folderName = $weldLog->test_package_no; @mkdir("$tpBasePath/$folderName", 0777, true); if(isset($accDocTypes['as-builds'])) { $docNo = $accDocTypes['as-builds']; $search = glob("storage/documents/001_Drawings/003_As_Build(ID)/*$isometric*.pdf"); if(isset($search[0])) { copy($search[0], "$clientBasePath/$folderName/$docNo - $isometric.pdf"); } } if(isset($accDocTypes['line-number'])) { $docNo = $accDocTypes['line-number']; $search = glob("$jsrPath/*{$weldLog->line_number}*.pdf"); if(isset($search[0])) { copy($search[0], "$tpBasePath/$folderName/$docNo - ЖСР_{$weldLog->line_number}.pdf"); } } if(isset($accDocTypes['clearance-list'])) { $docNo = $accDocTypes['clearance-list']; $search = glob("$clearancePath/*{$weldLog->clearance_no}*.pdf"); if(isset($search[0])) { copy($search[0], "$tpBasePath/$folderName/$docNo - {$weldLog->clearance_no}.pdf"); } } foreach($certificates AS $certificate) { if(isset($accDocTypes['naks-certificates'])) { $docNo = $accDocTypes['naks-certificates']; $search = glob("$naksPath/*$certificate*{$weldLog->welder_1}*.pdf"); if(isset($search[0])) { copy($search[0], "$tpBasePath/$folderName/$docNo - ".$certificate."_{$weldLog->welder_1}.pdf"); } $search = glob("$naksPath/*$certificate*{$weldLog->welder_2}*.pdf"); if(isset($search[0])) { copy($search[0], "$tpBasePath/$folderName/$docNo - ".$certificate."_{$weldLog->welder_2}.pdf"); } } } if(isset($accDocTypes['wpqr'])) { $docNo = $accDocTypes['wpqr']; $search = glob("$wqtrPath/*{$weldLog->wpq_report_1}*.pdf"); if(isset($search[0])) { copy($search[0], "$tpBasePath/$folderName/$docNo - {$weldLog->wpq_report_1}.pdf"); } } if(isset($accDocTypes['wpqr'])) { $docNo = $accDocTypes['wpqr']; $search = glob("$wqtrPath/*{$weldLog->wpq_report_2}*.pdf"); if(isset($search[0])) { copy($search[0], "$tpBasePath/$folderName/$docNo - {$weldLog->wpq_report_2}.pdf"); } } if(isset($accDocTypes['ndt-reports'])) { $docNo = $accDocTypes['ndt-reports']; $search = glob("$QABasePath/0000_VT/{$weldLog->vt_report}.pdf"); if(isset($search[0])) { copy($search[0], "$tpBasePath/$folderName/$docNo - {$weldLog->vt_report}.pdf"); } $search = glob("$QABasePath/0001_RT/{$weldLog->rt_report}.pdf"); if(isset($search[0])) { copy($search[0], "$tpBasePath/$folderName/$docNo - {$weldLog->rt_report}.pdf"); } $search = glob("$QABasePath/0002_UT/{$weldLog->ut_report}.pdf"); if(isset($search[0])) { copy($search[0], "$tpBasePath/$folderName/$docNo - {$weldLog->ut_report}.pdf"); } $search = glob("$QABasePath/0003_MT/{$weldLog->mt_report}.pdf"); if(isset($search[0])) { copy($search[0], "$tpBasePath/$folderName/$docNo - {$weldLog->mt_report}.pdf"); } $search = glob("$QABasePath/0004_PT/{$weldLog->pt_report}.pdf"); if(isset($search[0])) { copy($search[0], "$tpBasePath/$folderName/$docNo - {$weldLog->pt_report}.pdf"); } $search = glob("$QABasePath/0005_PMI/{$weldLog->pmi_report}.pdf"); if(isset($search[0])) { copy($search[0], "$tpBasePath/$folderName/$docNo - {$weldLog->pmi_report}.pdf"); } $search = glob("$QABasePath/0006_Ferrite/{$weldLog->ferrite_report}.pdf"); if(isset($search[0])) { copy($search[0], "$tpBasePath/$folderName/$docNo - {$weldLog->ferrite_report}.pdf"); } $search = glob("$QABasePath/0007_PWHT/{$weldLog->no_of_pwht_report}.pdf"); if(isset($search[0])) { copy($search[0], "$tpBasePath/$folderName/$docNo - {$weldLog->no_of_pwht_report}.pdf"); } } } $_GET['line_number'] = implode(",", $test_package_numbers); $redirect = false; ?>