106 lines
2.5 KiB
PHP
106 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use Illuminate\Http\Request;
|
|
use Spatie\Permission\Models\Role;
|
|
use Spatie\Permission\Models\Permission;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use App\Models\User;
|
|
use PDF;
|
|
use App\Models\Cawangan;
|
|
use App\Models\JenisEmas;
|
|
use App\Models\JenisKarat;
|
|
|
|
use App\Models\Simulasi;
|
|
use App\Models\SimulasiBid;
|
|
use App\Models\SimulasiBidMarhun;
|
|
use App\Models\SimKarat;
|
|
use App\Models\SimKarat_temp;
|
|
use App\Models\CawanganSimulasi;
|
|
|
|
|
|
use App\Models\Lelong;
|
|
use App\Models\CawanganLelong;
|
|
use App\Models\LelongBid;
|
|
use App\Models\LelongBidMarhun;
|
|
use App\Models\LelKarat;
|
|
use App\Models\LelKarat_temp;
|
|
use Carbon\Carbon;
|
|
|
|
class ApiController extends Controller
|
|
{
|
|
/**
|
|
* Create a new controller instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
|
|
/**
|
|
* Show the application dashboard.
|
|
*
|
|
* @return \Illuminate\Contracts\Support\Renderable
|
|
*/
|
|
|
|
public function biditem()
|
|
{
|
|
$currentdate = Carbon::now();
|
|
$currentdate = $currentdate->toDateString();
|
|
// dd($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 karat()
|
|
{
|
|
|
|
$jenisemas = JenisEmas::all();
|
|
$jeniskarat = JenisKarat::all();
|
|
|
|
|
|
if(sizeof($jenisemas)!=0 && sizeof($jeniskarat)!=0 )
|
|
{
|
|
return response()->json([
|
|
'success' => true,
|
|
'karat' => $jeniskarat,
|
|
'emas' => $jenisemas
|
|
]);
|
|
}
|
|
else
|
|
{
|
|
return response()->json([
|
|
'success' => false,
|
|
'message' => 'No Data',
|
|
], 401);
|
|
}
|
|
}
|
|
|
|
}
|
|
|