try test speed
This commit is contained in:
@@ -24,19 +24,19 @@ class HomeController extends Controller
|
||||
public function index()
|
||||
{
|
||||
$auth_user = Auth::user();
|
||||
$harga_emas = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/api/harga_emas/')->json();
|
||||
// $harga_emas = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') .'/api/harga_emas/')->json();
|
||||
|
||||
$hargaemasterdahulu = array();
|
||||
// $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();
|
||||
// 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;
|
||||
// $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]);
|
||||
// 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();
|
||||
@@ -61,26 +61,26 @@ class HomeController extends Controller
|
||||
$bilanganlelong += 1;
|
||||
}
|
||||
|
||||
$arraysag = [];
|
||||
$belum_tebus = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customers/'. $auth_user['icno'] . '/gadai/' . 'belum_tebus')->json();
|
||||
// $arraysag = [];
|
||||
// $belum_tebus = Http::withOptions(['verify' => config('app.api_verify')])->get(config('api.url') . '/api/customers/'. $auth_user['icno'] . '/gadai/' . 'belum_tebus')->json();
|
||||
|
||||
if(is_array($belum_tebus))
|
||||
{
|
||||
if(sizeof($belum_tebus) > 0)
|
||||
{
|
||||
foreach($belum_tebus as $index=>$bt)
|
||||
{
|
||||
foreach($bt as $index1=>$bet)
|
||||
{
|
||||
array_push($arraysag,$bet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// if(is_array($belum_tebus))
|
||||
// {
|
||||
// if(sizeof($belum_tebus) > 0)
|
||||
// {
|
||||
// foreach($belum_tebus as $index=>$bt)
|
||||
// {
|
||||
// foreach($bt as $index1=>$bet)
|
||||
// {
|
||||
// array_push($arraysag,$bet);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
$belum_tebus = $arraysag;
|
||||
// $belum_tebus = $arraysag;
|
||||
$api_url = config('api.url');
|
||||
|
||||
return view('includes.home',compact('api_url','belum_tebus','hargaemasterdahulu','bilangan','sixmonths','total','bilanganlelong'));
|
||||
return view('includes.home',compact('api_url','bilangan','sixmonths','total','bilanganlelong'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user