Files
finance/app/Http/Controllers/CurrencyController.php
T
Ümit Tunç f6ef9fafdc first commit
2025-01-17 21:38:08 +03:00

24 lines
589 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Http\Controllers;
use App\Jobs\FetchCurrencyRates;
use Illuminate\Support\Facades\Storage;
class CurrencyController extends Controller
{
public function getCurrentRates()
{
// Job'ı çalıştır
// $data = FetchCurrencyRates::dispatchSync();
// JSON dosyasından oku
if (Storage::exists('currency/today.json')) {
return response()->json(
json_decode(Storage::get('currency/today.json'), true)
);
}
return response()->json(['error' => 'Veri bulunamadı'], 404);
}
}