This commit is contained in:
meusinfirmary
2025-05-29 13:21:59 +07:00
parent 3b9d94620a
commit 77bc5f10a6
29 changed files with 2206 additions and 2247 deletions

View File

@ -37,9 +37,9 @@ class Vehicles extends Model
$select = "";
$where = "";
if ($auth->role == Users::ROLE_VENDOR) {
$where .= " AND v.vendor_id = " . $auth->uid;
}
// if ($auth->role == Users::ROLE_VENDOR) {
// $where .= " AND v.vendor_id = " . $auth->uid;
// }
if (isset($filter["company"])) {
$where .= " AND client.id = ?";
@ -106,10 +106,7 @@ class Vehicles extends Model
public static function getVehicleById($vid)
{
return DB::select(
"SELECT * FROM t_vehicles WHERE dlt is null AND id = ? LIMIT 1;",
[$vid]
);
return DB::select("SELECT * FROM t_vehicles WHERE dlt is null AND id = ? LIMIT 1;", [$vid]);
}
public static function getVehicleByDeviceId($device_id)
@ -122,10 +119,7 @@ class Vehicles extends Model
public static function getVehicleBySimcard($simcard)
{
return DB::select(
"SELECT * FROM t_vehicles WHERE dlt is null AND simcard = ? LIMIT 1;",
[$simcard]
);
return DB::select("SELECT * FROM t_vehicles WHERE dlt is null AND simcard = ? LIMIT 1;", [$simcard]);
}
public static function getVehicleByPlatNo($nopol1, $nopol2, $nopol3)
@ -177,9 +171,7 @@ class Vehicles extends Model
$where_in = substr($where_in, 0, -1);
}
return DB::select(
"SELECT * FROM t_vehicles WHERE dlt is null AND id IN (" .
$where_in .
");",
"SELECT * FROM t_vehicles WHERE dlt is null AND id IN (" . $where_in . ");",
$params
);
}
@ -227,10 +219,8 @@ class Vehicles extends Model
);
}
public static function getVehiclesInVendorIdsActiveNoInOrder(
$vendorIds,
$prefer_truck_type = 0
) {
public static function getVehiclesInVendorIdsActiveNoInOrder($vendorIds, $prefer_truck_type = 0)
{
$params = [];
$where_in = "";
$where_where = "";
@ -305,30 +295,22 @@ class Vehicles extends Model
// default 1: truck
public static function listCats()
{
return DB::select(
"SELECT * FROM t_vehicles_cats WHERE dlt is null AND is_active = 1;"
);
return DB::select("SELECT * FROM t_vehicles_cats WHERE dlt is null AND is_active = 1;");
}
// default 1: unknown
public static function listBrands()
{
return DB::select(
"SELECT * FROM t_vehicles_brands WHERE dlt is null AND is_active = 1;"
);
return DB::select("SELECT * FROM t_vehicles_brands WHERE dlt is null AND is_active = 1;");
}
public static function listTypes()
{
return DB::select(
"SELECT * FROM t_vehicles_types WHERE dlt is null AND is_active = 1;"
);
return DB::select("SELECT * FROM t_vehicles_types WHERE dlt is null AND is_active = 1;");
}
public static function listModels()
{
return DB::select(
"SELECT * FROM t_vehicles_models WHERE dlt is null AND is_active = 1;"
);
return DB::select("SELECT * FROM t_vehicles_models WHERE dlt is null AND is_active = 1;");
}
}