From 5d392ff50b4bdd372d6147b9ade22816b63ff503 Mon Sep 17 00:00:00 2001 From: "m.razaghi" Date: Sat, 15 Aug 2026 23:47:21 +0330 Subject: [PATCH] Added gold currency api --- app/Http/Controllers/api/CurrencyController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/api/CurrencyController.php b/app/Http/Controllers/api/CurrencyController.php index 9fbe3e6..f043061 100644 --- a/app/Http/Controllers/api/CurrencyController.php +++ b/app/Http/Controllers/api/CurrencyController.php @@ -29,7 +29,11 @@ class CurrencyController extends Controller // 4. Debug check: If it is STILL empty, the API failed and we have no backup data yet. if ($goldCurrencies->isEmpty()) { - return $this->failed(null, 'ارتباط با سرور قیمت‌ها برقرار نشد. لطفا بعدا تلاش کنید.'); + // FIX: Pass an array to format the 'alert' as a JSON Object for Kotlin! + return $this->failed(null, [ + 'title' => 'خطا', + 'message' => 'ارتباط با سرور قیمت‌ها برقرار نشد. لطفا بعدا تلاش کنید.' + ]); } // 5. Map the data @@ -61,7 +65,7 @@ class CurrencyController extends Controller try { $url = 'https://BrsApi.ir/Api/Market/Gold_Currency.php?key=B727Ue3kBrbtCwHR3BmSVZKRRNF1sllp'; - // FIX: Added withoutVerifying() for Iranian SSL issues and a User-Agent to bypass firewalls + // Added withoutVerifying() for Iranian SSL issues and a User-Agent to bypass firewalls $response = Http::withoutVerifying() ->withHeaders([ 'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',