diff --git a/app/Http/Controllers/CurrencyController.php b/app/Http/Controllers/CurrencyController.php index 7f02a45..05bb80c 100644 --- a/app/Http/Controllers/CurrencyController.php +++ b/app/Http/Controllers/CurrencyController.php @@ -21,4 +21,18 @@ class CurrencyController extends Controller return response()->json(['error' => 'Veri bulunamadı'], 404); } + + public function getCurrencyRateByName($currencyName) + { + // JSON dosyasından oku + if (Storage::exists('currency/today.json')) { + $data = json_decode(Storage::get('currency/today.json'), true); + if (isset($data[$currencyName])) { + return response()->json([$currencyName => $data[$currencyName]]); + } + return response()->json(['error' => 'Para birimi bulunamadı'], 404); + } + + return response()->json(['error' => 'Veri bulunamadı'], 404); + } } \ No newline at end of file