search lelong details by cawangan id
This commit is contained in:
@@ -115,4 +115,38 @@ class LelongMobileController extends Controller
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ Route::group(['middleware' => ['auth:sanctum']], function () {
|
||||
|
||||
// Lelong
|
||||
Route::get('/lelongDetails/today', [LelongMobileController::class, 'getlelongdetails']);
|
||||
Route::get('/lelongDetails/cawangan', [LelongMobileController::class, 'searchLelByCaw']);
|
||||
Route::get('/karat', [LelongMobileController::class, 'getListKarat']);
|
||||
|
||||
// Lelong => Bidder
|
||||
|
||||
Reference in New Issue
Block a user