diff --git a/app/Http/Controllers/Mobile/LelongMobileController.php b/app/Http/Controllers/Mobile/LelongMobileController.php index 0f1fdbd4..2871b28c 100644 --- a/app/Http/Controllers/Mobile/LelongMobileController.php +++ b/app/Http/Controllers/Mobile/LelongMobileController.php @@ -14,6 +14,7 @@ use App\Models\Payment; use App\Models\Cart; use Carbon\Carbon; use App\Models\Cawangan; +use App\Models\FileMarhun; use App\Models\Resit; use App\Models\FileResit; use App\Models\Invoice; @@ -365,11 +366,7 @@ class LelongMobileController extends Controller $listLelong = []; foreach ($arrayDiff2 as $index => $data) { - $lelongbid = LelongBid:: - // join('filemarhun', 'lelongbid.id', '=', 'filemarhun.lelongbid_id') - where('id', $data) - // ->where('photo_type', 1) - ->first()->toArray(); + $lelongbid = LelongBid::where('id', $data)->first()->toArray(); $lelongbidmarhun = LelongBidMarhun::where('lelongbid_id', $lelongbid['id'])->get()->toArray(); foreach ($lelongbidmarhun as $index1 => $marhun) { $marhunDesc = JenisEmas::where('marhun', $marhun['marhun'])->first()->toArray(); @@ -378,6 +375,12 @@ class LelongMobileController extends Controller $lelongbid['lelongbidmarhun'] = $lelongbidmarhun; + $fileMarhun = FileMarhun::where('lelongbid_id', $lelongbid['id'])->get(); + + if ($fileMarhun->isNotEmpty()) { + $lelongbid['filemarhun'] = $fileMarhun; + } + array_push($listLelong, $lelongbid); } $lelong['lelongbid'] = $listLelong; @@ -394,6 +397,16 @@ class LelongMobileController extends Controller } } + public function lelongOnline() + { + $lelong = Lelong::where('sts_lelong', '=', 1)->first(); + if ($lelong) { + return response()->json(['success' => true, 'lelong' => $lelong]); + } else { + return response()->json(['success' => false,]); + } + } + public function searchLelongByCawangan(Request $request){ $currentdate = Carbon::now(); diff --git a/routes/api.php b/routes/api.php index 2fd78832..48cc6779 100644 --- a/routes/api.php +++ b/routes/api.php @@ -57,6 +57,8 @@ Route::group(['middleware' => ['auth:sanctum']], function () { Route::get('/listcawlelongtodaystarted', [LelongMobileController::class, 'listCawLelongTodayStarted']); //list surat exclude in cart and bid-record Route::get('/lelongDetails/listSuratLelong', [LelongMobileController::class, 'listSuratLelong']); + //list lelong online + Route::get('/lelongOnline', [LelongMobileController::class, 'lelongOnline']);