diff --git a/app/Jobs/ProcessBillDetailDataJob.php b/app/Jobs/ProcessBillDetailDataJob.php new file mode 100644 index 0000000..2770fd7 --- /dev/null +++ b/app/Jobs/ProcessBillDetailDataJob.php @@ -0,0 +1,61 @@ +getFillable(); + while (($row = fgetcsv($handle, 0, ";")) !== false) { + if (count($headers) === count($row)) { + $data = array_combine($headers, $row); + + try { + TempBillDetail::upadteOrCreate(['_id',$data['_id']],$data); + } catch (Exception $e) { + \Log::error('Error processing bill detail: ' . $e->getMessage()); + } + } + } + fclose($handle); + } else { + throw new Exception("Unable to open file: {$filePath}"); + } + } catch (Exception $e) { + \Log::error('Error in ProcessBillDetailDataJob: ' . $e->getMessage()); + throw $e; + } + } +}