add jumlahPembiayaanMobile

This commit is contained in:
izzatizulkifli
2021-02-02 11:41:33 +08:00
parent 9919f92abe
commit de86f977c2
2 changed files with 12 additions and 0 deletions
@@ -418,4 +418,15 @@ class CustomerController extends Controller
return response('Deleted Successfully', 200);
}
public function jumlahPembiayaanMobile($nokp){
$cawangan_all = Cawangan::on('mysql7')->get();
$jumlahPembiayaan = 0;
foreach($cawangan_all as $index=>$cawangan){
$gadai = Gadai::on($cawangan['mysql'])->where([['nokp','=',$nokp],['sttebus','=','']])->sum('pinjaman');
$jumlahPembiayaan += $gadai;
}
return response()->json(number_format($jumlahPembiayaan,2));
}
}