update sah payment acc
This commit is contained in:
@@ -90,12 +90,12 @@ class AccountController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
return view('account.sahsagonline', compact('senaraisag', 'user_id', 'lelong_id','total_payment'));
|
||||
return view('account.sahsagonline', compact('senaraisag', 'lelong_id', 'user_id', 'total_payment'));
|
||||
}
|
||||
|
||||
public function sahbayaronline($lelong_id, $user_id)
|
||||
public function sahbayaronline(Request $request)
|
||||
{
|
||||
|
||||
// dd($request->all());
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateTimeString();
|
||||
|
||||
@@ -103,25 +103,26 @@ class AccountController extends Controller
|
||||
|
||||
$senaraisag = LelongBid::join('lelongbidder', 'lelongbid.id', '=', 'lelongbidder.lelongbid_id')
|
||||
->join('payment', 'lelongbid.id', '=', 'payment.lelongbid_id')
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->where('lelongbidder.user_id', $user_id)
|
||||
->where('lelongbid.lelong_id', $request->lelong_id)
|
||||
->where('lelongbidder.user_id', $request->user_id)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->where('payment.status_payment_opt', 2)
|
||||
->get();
|
||||
->get();
|
||||
|
||||
|
||||
$total_payment = 0;
|
||||
foreach($senaraisag as $sag)
|
||||
{
|
||||
$payment = Payment::where('lelong_id', $lelong_id)
|
||||
->where('user_id', $user_id)
|
||||
$payment = Payment::where('lelong_id', $request->lelong_id)
|
||||
->where('user_id', $request->user_id)
|
||||
->where('lelongbid_id',$sag->lelongbid_id)
|
||||
->first();
|
||||
|
||||
$payment->disahkan_oleh = $user->id;
|
||||
$payment->disahkan_pada = $currentdate;
|
||||
$payment->save();
|
||||
|
||||
$total_payment = $total_payment + $payment->total_payment;
|
||||
|
||||
$updatelelbidbidder = LelongBidder::where('lelongbid_id', $sag->lelongbid_id)
|
||||
->first();
|
||||
$updatelelbidbidder->status_payment = 1;
|
||||
@@ -133,14 +134,14 @@ class AccountController extends Controller
|
||||
$eachbid->save();
|
||||
|
||||
}
|
||||
|
||||
|
||||
$senaraisagallpayment = LelongBid::join('lelongbidder', 'lelongbid.id', '=', 'lelongbidder.lelongbid_id')
|
||||
->where('lelongbid.lelong_id', $lelong_id)
|
||||
->where('lelongbidder.user_id', $user_id)
|
||||
->where('lelongbid.lelong_id', $request->lelong_id)
|
||||
->where('lelongbidder.user_id', $request->user_id)
|
||||
->where('lelongbidder.status_bidder', 1)
|
||||
->get();
|
||||
// dd($senaraisagallpayment);
|
||||
$resit = Resit::where('id',$payment->resit_id)->first();
|
||||
|
||||
$resit = Resit::where('id', $payment->resit_id)->first();
|
||||
$resit->total_payment = $resit->total_payment + $total_payment;
|
||||
|
||||
if($resit->total_payment >= $senaraisagallpayment->sum('hargabida'))
|
||||
|
||||
Reference in New Issue
Block a user