json( json_decode(Storage::get($jsonFile), true) ); } return response()->json(['error' => 'Veri bulunamadı'], 404); } public function getCurrentRates() { // JSON dosyasından oku $jsonFile = 'currency/today.json'; if (Storage::exists($jsonFile)) { return response()->json( json_decode(Storage::get($jsonFile), true) ); } return response()->json(['error' => 'Veri bulunamadı'], 404); } public function getGoldRates() { // JSON dosyasından oku $jsonFile = 'gold/today.json'; if (Storage::exists($jsonFile)) { return response()->json( json_decode(Storage::get($jsonFile), true) ); } return response()->json(['error' => 'Veri bulunamadı'], 404); } public function getCurrencyRateByName($currencyName) { // JSON dosyasından oku $jsonFile = 'currency/today.json'; if (Storage::exists($jsonFile)) { $data = json_decode(Storage::get($jsonFile), true); if (isset($data[$currencyName])) { return response()->json([$currencyName => $data[$currencyName]]); } return response()->json(['error' => 'Currency not found'], 404); } return response()->json(['error' => 'Data not found'], 404); } public function getGoldRateByName($goldName) { // JSON dosyasından oku $jsonFile = 'gold/today.json'; if (Storage::exists($jsonFile)) { $data = json_decode(Storage::get($jsonFile), true); if (isset($data[$goldName])) { return response()->json([$goldName => $data[$goldName]]); } return response()->json(['error' => 'Currency not found'], 404); } return response()->json(['error' => 'Data not found'], 404); } }