diff --git a/app/Http/Controllers/AuthMobile/LelongMobileController.php b/app/Http/Controllers/AuthMobile/LelongMobileController.php index cf9e7578..593cc723 100644 --- a/app/Http/Controllers/AuthMobile/LelongMobileController.php +++ b/app/Http/Controllers/AuthMobile/LelongMobileController.php @@ -62,10 +62,6 @@ class LelongMobileController extends Controller public function bidderSelectBidItem(Request $request){ - // $feepayment = Payment::select('status') - // ->where('status', 1) - // ->first(); - $feepayment = Payment::where('status', '=', 1)->first(); if($feepayment != null){ @@ -103,4 +99,54 @@ class LelongMobileController extends Controller return response()->json("unsuccess", 201); } } + + public function listBidItem(Request $request){ + + $lelongbidder = LelongBidder::where('user_id','=', $request->user_id) + ->get()->toArray(); + + foreach($lelongbidder as $index1=>$lelbid) + { + $lelongbid = LelongBid::whereIn('id',$lelongbidder) + ->get()->toArray(); + + $lelongbidder[$index1]['lelongbid'] = $lelongbid; + } + + return response()->json($lelongbidder); + } + + public function searchLelByCaw(Request $request){ + + $currentdate = Carbon::now(); + $currentdate = $currentdate->toDateString(); + + // $arrayLelong = []; + $lelong = Lelong::join('cawangan_lelong', 'lelong.id', '=', 'cawangan_lelong.lelong_id') + ->where('tarikh_lelong','=',$currentdate) + ->where('caw_id', '=', $request->caw_id) + ->get()->toArray(); + + foreach($lelong as $index1=>$lel) + { + $lelongbid = LelongBid::where('lelong_id',$lel['lelong_id']) + ->get()->toArray(); + + $lelong[$index1]['lelongbid'] = $lelongbid; + + foreach($lelongbid as $index2=>$lelbidmarhun){ + $cawangan = Cawangan::where('id','=',$lelbidmarhun['caw_id'])->first()->toArray(); + // $id = lelongbid::first(); + + $lelongbidmarhun = LelongBidMarhun::where('lelongbid_id', $lelbidmarhun['id']) + ->get()->toArray(); + + $lelong[$index1]['lelongbid'][$index2]['lelongbidmarhun'] = $lelongbidmarhun; + $lelong[$index1]['lelongbid'][$index2]['cawangan'] = $cawangan; + } + + } + + return response()->json($lelong); + } } diff --git a/routes/api.php b/routes/api.php index 0c15c6fd..1a653a4c 100644 --- a/routes/api.php +++ b/routes/api.php @@ -36,20 +36,28 @@ Route::get('/pembayaran/backend', [ApiController::class, 'callback'])->name('pa //Protected routes Route::group(['middleware' => ['auth:sanctum']], function () { + // User Route::post('/logout', [AuthController::class, 'logout']); Route::get('/user/profile/{nokp}', [UserController::class, 'getProfileUser']); - - - - Route::post('/updateItem', [CartController::class, 'updateItem']); - Route::get('/deleteItem/{id}', [CartController::class, 'deleteCart']); Route::post('/forgotPassword', [NewPasswordController::class, 'forgotPassword']); Route::post('/reset', [NewPasswordController::class, 'reset']); + + // User Profile Route::get('/user/profile', [UserController::class, 'getProfileUser']); Route::put('/userUpdate/profile', [UserController::class, 'updateProfileUser']); + + // Cart + Route::post('/updateItem', [CartController::class, 'updateItem']); + Route::get('/deleteItem/{id}', [CartController::class, 'deleteCart']); + + // Lelong Route::get('/lelongDetails/today', [LelongMobileController::class, 'getlelongdetails']); + Route::get('/lelongDetails/cawangan', [LelongMobileController::class, 'searchLelByCaw']); Route::get('/karat', [LelongMobileController::class, 'getListKarat']); + + // Lelong => Bidder Route::post('/bidder/biditem', [LelongMobileController::class, 'bidderSelectBidItem']); + Route::get('/bidder/listbiditem', [LelongMobileController::class, 'listBidItem']); });