24 lines
589 B
PHP
24 lines
589 B
PHP
<?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);
|
||
}
|
||
} |