get lelong details & get list karat

This commit is contained in:
faiqahzaman
2022-01-23 16:02:04 +08:00
parent 073cf456cf
commit 62899b4d55
4 changed files with 116 additions and 39 deletions
@@ -7,6 +7,7 @@ use Illuminate\Http\Request;
use App\Models\Lelong;
use App\Models\LelongBid;
use App\Models\LelongBidMarhun;
use App\Models\lelkarat;
use Carbon\Carbon;
class LelongMobileController extends Controller
@@ -53,11 +54,8 @@ class LelongMobileController extends Controller
$currentdate = Carbon::now();
$currentdate = $currentdate->toDateString();
$lelong = Lelong::where('tarikh_lelong','=',$currentdate)->get();
$arrayLelong = [];
$lelong = Lelong::where('tarikh_lelong','=',$currentdate)->get();
// $arrayLelong = [];
$lelong = Lelong::where('tarikh_lelong','=',$currentdate)->get()->toArray();
// $lelongbid = LelongBid::where('t_lelong', '=', $currentdate)
// ->select('lelong_id',
// 'id as lelongbid_id',
@@ -85,41 +83,60 @@ class LelongMobileController extends Controller
// 'status_payment')
// ->get();
$lelongbid = LelongBid::whereIn('lelong_id',$arrayLelong)
->select('lelong_id',
'id as lelongbid_id',
'caw_id',
'kodcaw',
'norujukan',
't_lelong as tarikh_lelong',
'hargaasas',
'hargajual',
't_jual',
'nopembeli',
'jbg',
'kadarupah',
'upahsimpan',
'ansuran',
'pinjaman',
'bakiupah',
'cajlain',
'cajlelong',
'baki',
'gst_hj',
'gst_cl',
'percent',
'status_jual',
'status_payment')
->union($lelong)
->get();
foreach($lelong as $index1=>$lel)
{
$lelongbid = LelongBid::whereIn('lelong_id',$lelong)
->select('lelong_id',
'id as lelongbid_id',
'caw_id',
'kodcaw',
'norujukan',
't_lelong as tarikh_lelong',
'hargaasas',
'hargajual',
't_jual',
'nopembeli',
'jbg',
'kadarupah',
'upahsimpan',
'ansuran',
'pinjaman',
'bakiupah',
'cajlain',
'cajlelong',
'baki',
'gst_hj',
'gst_cl',
'percent',
'status_jual',
'status_payment')
// ->union($lelong)
->get()->toArray();
$lelongbidmarhun = LelongBidMarhun::join('lelongbid', 'lelongbidmarhun.lelongbid_id', '=', 'lelongbid.id')
->get();
$lelongbidmarhun = LelongBidMarhun::join('lelongbid', 'lelongbidmarhun.lelongbid_id', '=', 'lelongbid.id')
->get()->toArray();
array_push($arrayLelong,['lelong' => $lelong,'lelong_bid' => $lelongbid, 'lelong_bid_marhun' => $lelongbidmarhun]);
$lelong[$index1]['lelongbid'] = $lelongbid;
$lelong[$index1]['lelongbid']['lelongbidmarhun'] = $lelongbidmarhun;
// array_push($lelong[$index1],'lelongzz','lasdsa');
// array_push($lelong[$index1],['lelong_bid' => $lelongbid[0], 'lelong_bid_marhun' => $lelongbidmarhun]);
}
return response()->json($lelong);
return response()->json($arrayLelong);
}
public function getListKarat(Request $request){
$getKarat = lelkarat::all();
// $user = User::all();
return response()->json($getKarat);
}
}