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

@ -68,19 +68,14 @@ class Drivers extends Model
$params = [];
$where_vendor = "";
$join_vendor = "";
if ($auth->role != Users::ROLE_ADMIN) {
$where_vendor .= " AND d.vendor_id = " . $auth->uid;
}
// if ($auth->role != Users::ROLE_ADMIN) {
// $where_vendor .= " AND d.vendor_id = " . $auth->uid;
// }
if (isset($filter["status"])) {
$where_vendor .= " AND d.status = ?";
array_push($params, $filter["status"]);
}
return DB::select(
"SELECT * FROM t_drivers as d WHERE dlt is null " .
$where_vendor .
";",
$params
);
return DB::select("SELECT * FROM t_drivers as d WHERE dlt is null " . $where_vendor . ";", $params);
}
public static function showDriverById($did)
@ -99,34 +94,22 @@ class Drivers extends Model
public static function getDriverById($did)
{
return DB::select(
"SELECT * FROM t_drivers WHERE dlt is null AND id = ? LIMIT 1;",
[$did]
);
return DB::select("SELECT * FROM t_drivers WHERE dlt is null AND id = ? LIMIT 1;", [$did]);
}
public static function getDriverByEmail($email)
{
return DB::select(
"SELECT * FROM t_drivers WHERE dlt is null AND email = ? LIMIT 2;",
[$email]
);
return DB::select("SELECT * FROM t_drivers WHERE dlt is null AND email = ? LIMIT 2;", [$email]);
}
public static function getDriverByPhone($phone)
{
return DB::select(
"SELECT * FROM t_drivers WHERE dlt is null AND phone = ? LIMIT 2;",
[$phone]
);
return DB::select("SELECT * FROM t_drivers WHERE dlt is null AND phone = ? LIMIT 2;", [$phone]);
}
public static function getDriverByNik($nik)
{
return DB::select(
"SELECT * FROM t_drivers WHERE dlt is null AND nik = ? LIMIT 2;",
[$nik]
);
return DB::select("SELECT * FROM t_drivers WHERE dlt is null AND nik = ? LIMIT 2;", [$nik]);
}
public static function getDriverByIdAllData($did)