Files
gps-frontend/app/Models/DriversDetail.php
meusinfirmary b9891d2f81 Initial commit
2025-04-22 14:33:37 +07:00

41 lines
1010 B
PHP
Executable File

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class DriversDetail extends Model
{
public static function getDetailByDid($did)
{
return DB::select("SELECT * FROM t_drivers_detail WHERE did = ? LIMIT 1;", [$did]);
}
public static function getDetailById($id)
{
return DB::select("SELECT * FROM t_drivers_detail WHERE id = ? LIMIT 1;", [$id]);
}
public static function addDetail($data)
{
$id = DB::table("t_drivers_detail")->insertGetId($data);
return $id;
}
public static function updateDetailByDid($id, $data)
{
return DB::table("t_drivers_detail")->where("did", $id)->update($data);
}
public static function updateDetail($id, $data)
{
return DB::table("t_drivers_detail")->where("id", $id)->update($data);
}
public static function deleteDetail($id)
{
return DB::table("t_drivers_detail")->where("id", $id)->delete();
}
}