list vehicle

This commit is contained in:
Pringgosutono
2025-12-01 19:29:25 +07:00
parent 0fcb81a1a4
commit fd5a88205c
4 changed files with 108 additions and 24 deletions

View File

@ -60,6 +60,45 @@ class VehiclesController extends Controller
}
}
public function api_list_vehicles1(Request $req)
{
try {
$now = time();
$input = [];
$rulesInput = [];
$filter = [];
if ($req->cptid) {
$filter["company"] = $req->cptid;
}
$list = DB::select("SELECT
v.id, v.name, v.device_id, nopol1, nopol2, nopol3, v.sum_milleage,
fvhc_img, vyear, t.`desc` type_name, c_name company_name, crt_d, dvc.crt
FROM t_vehicles as v
INNER JOIN t_vehicles_detail AS vd ON v.id = vd.vid
LEFT JOIN t_vehicles_types AS t ON v.type_id = t.id
LEFT JOIN t_users AS vdr ON v.vendor_id = vdr.id
LEFT JOIN t_clients AS client ON vdr.client_group_id = client.id
LEFT JOIN t_devices AS dvc ON v.device_id = dvc.device_id
left join t_gps_tracks_rltm rltm on rltm.vhc_id = v.id
WHERE v.dlt is null
ORDER BY v.id ASC
");
foreach ($list as $key => $row) {
$list[$key]->DT_RowIndex = $key + 1;
$list[$key]->action = "-";
}
$apiResp = Responses::success("success list vehicles");
$apiResp["data"] = $list;
return new Response($apiResp, $apiResp["meta"]["code"]);
} catch (\Exception $e) {
$apiResp = Responses::error($e->getMessage());
return new Response($apiResp, $apiResp["meta"]["code"]);
}
}
public function api_show_vehicle(Request $req, $vid)
{
try {