middleware(['auth','verified']); } /** * Show the application dashboard. * * @return \Illuminate\View\View */ public function index() { $auth_user = Auth::user(); $harga_emas = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/api/harga_emas/')->json(); $hargaemasterdahulu = array(); foreach($harga_emas as $index=>$harga) { $hargaemassandaran = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/api/harga_emas/rekod/sandaran',['karat' => $harga['karat']])->json(); $percentnaik = (floatval($harga['harga']) - floatval($hargaemassandaran[1]['harga'])) / ($hargaemassandaran[1]['harga']) * 100; array_push($hargaemasterdahulu,['karat' => $harga['karat'],'hargasemasa' => $harga['harga'], 'hargadahulu' => $hargaemassandaran[1]['harga'],'percent' => $percentnaik]); } $CustomerInfo = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/portal/customer/info',['ic' => $auth_user['icno']])->json(); $total = 0.00; $sixmonths = 0; $bilangan = 0; foreach($CustomerInfo['gadai'] as $index=>$gadai) { $bilangan++; $total += $gadai['pinjaman']; if($gadai['tempoh'] >= 6) { $sixmonths++; } } $bilanganlelong = 0; foreach($CustomerInfo['lelong'] as $index1=>$lelong) { $bilanganlelong += 1; } return view('includes.home',compact('hargaemasterdahulu','bilangan','sixmonths','total','bilanganlelong')); } }