update
This commit is contained in:
@@ -64,15 +64,17 @@ class LelongMobileController extends Controller
|
||||
|
||||
public function bidderSelectBidItem(Request $request){
|
||||
|
||||
$feepayment = Payment::where('status', '=', 1)->first();
|
||||
$feepayment = Payment::where('lelong_id', '=', $request->lelong_id)->first();
|
||||
|
||||
if($feepayment != null){
|
||||
|
||||
$user = User::where('id', '=', $request->user_id)
|
||||
->first();
|
||||
|
||||
$selectBid = Cart::join('lelongbid', 'carts.lelongbid_id', '=', 'lelongbid.id')
|
||||
->where('lelongbid.norujukan', $request->norujukan)
|
||||
$carts = Cart::join('lelongbid', 'carts.lelongbid_id', '=', 'lelongbid.id')
|
||||
join('lelong', 'lelongbid.lelong_id', '=', 'lelong.id')
|
||||
->where('lelong.sts_lelong','=',1)
|
||||
->where('carts.user_id', $user->id)
|
||||
->select('lelongbid.id as lelongbid_id',
|
||||
'lelongbid.t_lelong',
|
||||
'lelongbid.nilaimarhun',
|
||||
@@ -84,16 +86,20 @@ class LelongMobileController extends Controller
|
||||
|
||||
$currentdate = Carbon::now()->toDateTimeString();
|
||||
|
||||
$lelongBidder = new LelongBidder();
|
||||
$lelongBidder->nama_bidder = $request->name;
|
||||
$lelongBidder->user_id = $user->id;
|
||||
$lelongBidder->notelbimbit = $user->notelbimbit;
|
||||
$lelongBidder->hargabida = $selectBid[0]->hargabida;
|
||||
$lelongBidder->lelongbid_id = $selectBid[0]->lelongbid_id;
|
||||
$lelongBidder->nilaimarhun = $selectBid[0]->nilaimarhun;
|
||||
$lelongBidder->cajlelong = $selectBid[0]->cajlelong;
|
||||
$lelongBidder->masa_bidaan = $currentdate;
|
||||
$lelongBidder->save();
|
||||
foreach($carts as $cart)
|
||||
{
|
||||
$lelongBidder = new LelongBidder();
|
||||
$lelongBidder->nama_bidder = $request->name;
|
||||
$lelongBidder->user_id = $user->id;
|
||||
$lelongBidder->notelbimbit = $user->notelbimbit;
|
||||
$lelongBidder->hargabida = $cart->hargabida;
|
||||
$lelongBidder->lelongbid_id = $cart->lelongbid_id;
|
||||
$lelongBidder->nilaimarhun = $cart->nilaimarhun;
|
||||
$lelongBidder->cajlelong = $cart->cajlelong;
|
||||
$lelongBidder->masa_bidaan = $currentdate;
|
||||
$lelongBidder->save();
|
||||
|
||||
}
|
||||
|
||||
return response()->json("success", 201);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user