diff --git a/app/Jobs/ProcessArrangementDataJob.php b/app/Jobs/ProcessArrangementDataJob.php new file mode 100644 index 0000000..cb03da7 --- /dev/null +++ b/app/Jobs/ProcessArrangementDataJob.php @@ -0,0 +1,68 @@ +getFillable(); + + while (($row = fgetcsv($handle, 0, ";")) !== false) { + unset($row[0]); // Remove the first empty column if present + if (count($headers) === count($row)) { + $data = array_combine($headers, $row); + TempArrangement::updateOrCreate( + ['arrangement_id' => $data['arrangement_id']], // key to find existing record + $data // data to update or create + ); + } + } + fclose($handle); + } else { + throw new Exception("Unable to open file: {$filePath}"); + } + } catch (Exception $e) { + Log::error('Error in ProcessArrangementDataJob: ' . $e->getMessage()); + throw $e; + } + } + }