For this:
$cashbook = tblMainCashBook::whereBetween('date',[$request->input('from'),$request->input('to')])->paginate(50);
Is correct data showing in network tab. And no idea how response is handled.
I use laravel pagination to paginate data. its work but if I request it page to it response empty data array.
This is mt function
$cashbook = tblMainCashBook::whereBetween('date',[$request->input('from'),$request->input('to')])->paginate(50);
$cashbook2 = tblMainCashBook::whereBetween('date',[$request->input('from'),$request->input('to')])->get();
$cashbooktotDr = $cashbook2->sum('dr');
$cashbooktotCr = $cashbook2->sum('cr');
$cashbookBal = $cashbooktotDr - $cashbooktotCr;
$getLastBalDate = tblBalCarFor::get()->last();
if(isset($getLastBalDate)){
$balanceCarTot = $cashbookBal + $getLastBalDate->balance;
$balCar = $getLastBalDate->balance;;
}else{
$balanceCarTot = $cashbookBal;
$balCar = 0;
}
return response()->json(['cashbook'=> $cashbook,'Dr'=>$cashbooktotDr,'Cr'=>$cashbooktotCr,'Bal'=>$cashbookBal,'BalanceCarried'=> $balCar , 'BalanceCarriedTot'=>$balanceCarTot], 200);
What is the problem? thank you..
Please or to participate in this conversation.