143 lines
4.6 KiB
PHP
143 lines
4.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\AuthMobile;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
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
|
|
{
|
|
public function listLelongDetails(Request $request){
|
|
|
|
$currentdate = Carbon::now();
|
|
$currentdate = $currentdate->toDateString();
|
|
|
|
$lelong = Lelong::where('tarikh_lelong','=',$currentdate)->get();
|
|
|
|
$arrayID = [];
|
|
foreach($lelong as $data)
|
|
{
|
|
array_push($arrayID,$data->id);
|
|
}
|
|
$lelongbid = LelongBid::whereIn('lelong_id',$arrayID)
|
|
->join('lelongbidmarhun','lelongbid.id','=','lelongbidmarhun.lelongbid_id')
|
|
->get();
|
|
|
|
$surat = LelongBid::whereIn('lelong_id',$arrayID)->get();
|
|
|
|
if(sizeof($lelongbid)!=0)
|
|
{
|
|
return response()->json([
|
|
'success' => true,
|
|
'lelong' => $lelong,
|
|
'surat' => $surat,
|
|
'item' => $lelongbid
|
|
]);
|
|
}
|
|
else
|
|
{
|
|
return response()->json([
|
|
'success' => false,
|
|
'message' => 'No Data',
|
|
], 401);
|
|
}
|
|
|
|
}
|
|
|
|
public function getlelongdetails(Request $request){
|
|
|
|
$currentdate = Carbon::now();
|
|
$currentdate = $currentdate->toDateString();
|
|
|
|
// $arrayLelong = [];
|
|
$lelong = Lelong::where('tarikh_lelong','=',$currentdate)->get()->toArray();
|
|
// $lelongbid = LelongBid::where('t_lelong', '=', $currentdate)
|
|
// ->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')
|
|
// ->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()->toArray();
|
|
|
|
$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);
|
|
|
|
}
|
|
|
|
public function getListKarat(Request $request){
|
|
|
|
$getKarat = lelkarat::all();
|
|
|
|
// $user = User::all();
|
|
|
|
return response()->json($getKarat);
|
|
|
|
}
|
|
}
|