dashboard api

This commit is contained in:
izzatizulkifli
2021-01-03 17:11:30 +08:00
parent 2bea4a1d29
commit dd3ed92b90
2 changed files with 24 additions and 0 deletions
+20
View File
@@ -795,5 +795,25 @@ class GadaiController extends Controller
}
public function showAllGadaiToday()
{
$cawangan_all = Cawangan::on('mysql7')->get();
$current = Carbon::now();
$current = new Carbon();
$gadaiToday = 0;
foreach($cawangan_all as $index=>$cawangan){
$gadai = Gadai::on($cawangan['mysql'])->where('t_gadai','=',$current->toDateString())->get();
if(sizeof($gadai) != 0){
foreach($gadai as $gadaiall)
{
$gadaiToday += $gadaiall['pinjaman'];
}
}
}
return response()->json($gadaiToday);
}
}