update latest
- jana pemenang - resit
This commit is contained in:
@@ -121,6 +121,10 @@ class PaymentController extends Controller
|
||||
|
||||
$bid_id = explode(",", $request->eachbid);
|
||||
|
||||
$resit = Resit::where('lelong_id', $lelong_id)
|
||||
->first();
|
||||
|
||||
$total_hargabida = 0;
|
||||
foreach($bid_id as $bid){
|
||||
|
||||
$eachbid = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id')
|
||||
@@ -135,12 +139,7 @@ class PaymentController extends Controller
|
||||
)
|
||||
->first();
|
||||
|
||||
$resit = Resit::where('lelongbid_id', $eachbid->lelongbid_id)
|
||||
->first();
|
||||
$resit->status = 'PAID';
|
||||
$resit->paid_at = $currentdate;
|
||||
$resit->update();
|
||||
|
||||
$total_hargabida = $total_hargabida + $eachbid->hargabida;
|
||||
$payment = Payment::create([
|
||||
'user_id' => $request->user_id,
|
||||
'lelongbidder_id' => $eachbid->lelongbidder_id,
|
||||
@@ -177,7 +176,12 @@ class PaymentController extends Controller
|
||||
$eachbid->update();
|
||||
|
||||
}
|
||||
|
||||
if($request->amaunkiraan == $total_hargabida){
|
||||
$resit->total_payment = $total_hargabida;
|
||||
$resit->status = 'PAID';
|
||||
$resit->paid_at = $currentdate;
|
||||
$resit->update();
|
||||
}
|
||||
return redirect()->route('pembayaran.SenaraiLelongBayar')->with('success','Pembayaran Berjaya');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user