This commit is contained in:
Amir
2022-10-05 12:35:34 +08:00
parent 2f4d40aed1
commit 7c38c7619d
3 changed files with 38 additions and 23 deletions
@@ -66,13 +66,24 @@ class LelongMobileController extends Controller
}
public function getListKarat(Request $request){
public function getListKarat()
{
$getKarat = LelKarat::all();
// $lelongBidder = lelongBidder::all();
return response()->json($getKarat);
$activeLelong = Lelong::where('sts_lelong', '=', 1)->first();
if (isset($activeLelong)) {
$getKarat = LelKarat::where('lelong_id', '=' ,$activeLelong['id'])->get();
$updatedDateTime = $getKarat[0]['updated_at']->toDateTimeString();
return response()->json([
'success' => true,
'karat' => $getKarat,
'update_time' => $updatedDateTime
], 201);
} else {
return response()->json([
'success' => false,
], 201);
}
}
@@ -315,7 +326,6 @@ class LelongMobileController extends Controller
public function listSuratLelong(Request $request)
{
$currentdate = Carbon::now();
$currentdate = $currentdate->toDateString();
@@ -323,10 +333,10 @@ class LelongMobileController extends Controller
->where('tarikh_lelong', '=', $currentdate)
->where('caw_id', '=', $request->caw_id)
->where('status_online', '=', 1)
->get()->toArray();
->first();
foreach ($lelong as $index1 => $lel) {
$lelongbid = LelongBid::where('lelong_id', $lel['lelong_id'])
if ($lelong) {
$lelongbid = LelongBid::where('lelong_id', $lelong['lelong_id'])
->where('caw_id', '=', $request->caw_id)
->select('id', 'kodcaw')
->get();
@@ -350,21 +360,23 @@ class LelongMobileController extends Controller
$listLelong = [];
foreach ($arrayDiff2 as $index => $data) {
$lelongbid = LelongBid::where('id', $data)->first()->toArray();
$lelongbid = LelongBid::
// join('filemarhun', 'lelongbid.id', '=', 'filemarhun.lelongbid_id')
where('id', $data)
// ->where('photo_type', 1)
->first()->toArray();
$lelongbidmarhun = LelongBidMarhun::where('lelongbid_id', $lelongbid['id'])->get()->toArray();
foreach ($lelongbidmarhun as $index1 => $marhun) {
$marhunDesc = JenisEmas::where('marhun', $marhun['marhun'])->first()->toArray();
$lelongbidmarhun[$index1]['marhun_desc'] = $marhunDesc['descpt'];
}
$lelongbid['lelongbidmarhun'] = $lelongbidmarhun;
array_push($listLelong, $lelongbid);
$lelong[$index1]['lelongbid'] = $listLelong;
}
}
$lelong['lelongbid'] = $listLelong;
if ($lelong) {
return response()->json(
['success' => true, 'message' => $lelong],
201
@@ -700,8 +712,8 @@ class LelongMobileController extends Controller
$currentdate = $currentdate->toDateString();
$lelong = Lelong::join('cawangan_lelong', 'lelong.id', '=', 'cawangan_lelong.lelong_id')
->join('cawangan', 'cawangan_lelong.caw_id', '=', 'cawangan.id')
->where('tarikh_lelong', '=', $currentdate)
->join('cawangan', 'cawangan_lelong.caw_id', '=', 'cawangan.id')
->where('tarikh_lelong', '=', $currentdate)
->select(
'lelong.id as lelong_id',
'lelong.tarikh_lelong',
@@ -710,12 +722,11 @@ class LelongMobileController extends Controller
'cawangan_lelong.masamula_lelong',
'cawangan_lelong.masatamat_lelong',
)
->get()->toArray();
if ($lelong) {
->get();
if ($lelong->isNotEmpty()) {
return response()->json([
'success' => true,
'lelong' => $lelong
'lelong' => $lelong,
]);
} else {
return response()->json([