46 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Models;
 | |
| 
 | |
| use Illuminate\Database\Eloquent\Model;
 | |
| use Illuminate\Support\Facades\DB;
 | |
| 
 | |
| class VehiclesDetail extends Model
 | |
| {
 | |
| 	public static function getDetailByVid($vid)
 | |
| 	{
 | |
| 		return DB::select("SELECT * FROM t_vehicles_detail WHERE vid = ? LIMIT 1;", [$vid]);
 | |
| 	}
 | |
| 
 | |
| 	public static function getDetailById($id)
 | |
| 	{
 | |
| 		return DB::select("SELECT * FROM t_vehicles_detail WHERE id = ? LIMIT 1;", [$id]);
 | |
| 	}
 | |
| 
 | |
| 	public static function addDetail($data)
 | |
| 	{
 | |
| 		$id = DB::table("t_vehicles_detail")->insertGetId($data);
 | |
| 		return $id;
 | |
| 	}
 | |
| 
 | |
| 	public static function updateDetail($id, $data)
 | |
| 	{
 | |
| 		return DB::table("t_vehicles_detail")->where("id", $id)->update($data);
 | |
| 	}
 | |
| 
 | |
| 	public static function updateDetailByVid($vid, $data)
 | |
| 	{
 | |
| 		return DB::table("t_vehicles_detail")->where("vid", $vid)->update($data);
 | |
| 	}
 | |
| 
 | |
| 	public static function deleteDetail($id)
 | |
| 	{
 | |
| 		return DB::table("t_vehicles_detail")->where("id", $id)->delete();
 | |
| 	}
 | |
| 
 | |
| 	public static function deleteDetailByVid($vid)
 | |
| 	{
 | |
| 		return DB::table("t_vehicles_detail")->where("vid", $vid)->delete();
 | |
| 	}
 | |
| }
 | 
