126 lines
4.1 KiB
PHP
126 lines
4.1 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 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();
|
|
|
|
$lelong = Lelong::where('tarikh_lelong','=',$currentdate)->get();
|
|
|
|
$arrayLelong = [];
|
|
$lelong = Lelong::where('tarikh_lelong','=',$currentdate)->get();
|
|
|
|
// $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();
|
|
|
|
$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();
|
|
|
|
$lelongbidmarhun = LelongBidMarhun::join('lelongbid', 'lelongbidmarhun.lelongbid_id', '=', 'lelongbid.id')
|
|
->get();
|
|
|
|
|
|
array_push($arrayLelong,['lelong' => $lelong,'lelong_bid' => $lelongbid, 'lelong_bid_marhun' => $lelongbidmarhun]);
|
|
|
|
return response()->json($arrayLelong);
|
|
|
|
}
|
|
}
|