From 11106995d4da018c50f8d037e691ed1bb55c5f0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=9Cmit=20Tun=C3=A7?= Date: Fri, 17 Jan 2025 22:58:51 +0300 Subject: [PATCH] Add MergeCurrencyAndGoldRates job to combine currency and gold rates - Introduced a new job class `MergeCurrencyAndGoldRates` to handle the merging of currency and gold rate data. - Implemented a method to retrieve data from JSON files stored in the application. - Merged the fetched currency and gold data into a single array. - Stored the combined data in a new JSON file for easy access and further processing. This commit enhances the application's ability to manage and utilize financial data by integrating currency and gold rates into a unified format. --- app/Jobs/MergeCurrencyAndGoldRates.php | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 app/Jobs/MergeCurrencyAndGoldRates.php diff --git a/app/Jobs/MergeCurrencyAndGoldRates.php b/app/Jobs/MergeCurrencyAndGoldRates.php new file mode 100644 index 0000000..7df5141 --- /dev/null +++ b/app/Jobs/MergeCurrencyAndGoldRates.php @@ -0,0 +1,35 @@ +getData('currency/today.json'); + $goldData = $this->getData('gold/today.json'); + + // Verileri birleştir + $mergedData = array_merge($currencyData, $goldData); + + // Birleştirilmiş veriyi dışarıya aktar + Storage::put('merged/rates.json', json_encode($mergedData, JSON_UNESCAPED_UNICODE)); + } + + private function getData($path) + { + if (Storage::exists($path)) { + return json_decode(Storage::get($path), true); + } + return []; + } +} \ No newline at end of file