added total of pinjaman and count

This commit is contained in:
hafifierahman
2024-12-14 20:08:09 +08:00
parent 98cb5a1d9a
commit 2d5aebcaea
+16 -2
View File
@@ -62,12 +62,26 @@ class HomeController extends Controller
$pembiayaan = $this->pembiayaanService->getPembiayaan($request->filter);
$authUser = Auth::user();
$customerInfo = Http::withOptions(['verify' => config('app.api_verify')])
$customer_pkb = Http::withOptions(['verify' => config('app.api_verify')])
->get(config('api.url') . '/portal/customer/info', ['ic' => $authUser['icno']])
->json();
['gadai' => $customer_gadai, 'lelong' => $customer_lelong] = $customerInfo;
$customer_koop = Http::withOptions(['verify' => config('app.api_verify')])
->get(config('api.url_koop') . '/portal/customer/info', ['ic' => $authUser['icno']])
->json();
// ['gadai' => $customer_gadai, 'lelong' => $customer_lelong] = $customerInfo;
$customer_gadai = array_merge(
$customer_pkb['gadai'] ?? [],
$customer_koop['gadai'] ?? []
);
$customer_lelong = array_merge(
$customer_pkb['lelong'] ?? [],
$customer_koop['lelong'] ?? []
);
// only get lelong that is harga jualan that is not null or 0
$customer_lelong = array_filter($customer_lelong, fn($x) => $x['hargajualan'] != null && $x['hargajualan'] != 0);