get(); //dump($nullDownload->count()); DB::beginTransaction(); $say = 0; $k = 0; Log::debug("📄$table PDF Link to DB Start " . simdi()); try { foreach($nullDownload AS $ne) { $data = "{$ne->wpq_document_no}"; $data = str_replace("/", "*", $data); $data = str_replace(" ", "*", $data); $data2 = "{$ne->naks_id}"; $data2 = str_replace("/", "*", $data2); $data2 = str_replace(" ", "*", $data2); if(trim($data) != "" || trim($data2) != "") { $path = "storage/documents/$mainPath/*$data*"; $searchPDF = glob($path); $updateData = []; $updateData['download'] = null; if(isset($searchPDF[0])) { $updateData['download'] = $searchPDF[0]; } /* $path2 = "storage/documents/$mainPath/*$data2*"; $searchPDF = glob($path2); if(isset($searchPDF[0])) { $updateData['download'] = $searchPDF[0]; } */ //dump($updateData['download']); // //dump($updateData); db($table) ->where("id", $ne->id) ->update($updateData); $k++; if($say == $commitSize) { //dump("commmit"); DB::commit(); DB::beginTransaction(); $say = 0; } $say++; } } DB::commit(); Log::debug("$table update PDF link for $k rows"); //dump("$table update PDF link for $k rows"); } catch (\Throwable $th) { DB::rollback(); Log::error("not update PDF links " . $th->getMessage()); ////dump($th->getMessage()); } Log::debug("📄$table PDF Link to DB Finish " . simdi()); ?>