Initial commit
This commit is contained in:
60
app/Models/OrdersVehicles.php
Executable file
60
app/Models/OrdersVehicles.php
Executable file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class OrdersVehicles extends Model
|
||||
{
|
||||
public static function get()
|
||||
{
|
||||
return DB::select("SELECT * FROM t_orders_vehicles;");
|
||||
}
|
||||
|
||||
public static function getById($id)
|
||||
{
|
||||
return DB::select("SELECT * FROM t_orders_vehicles WHERE id = ? LIMIT 1;", [$id]);
|
||||
}
|
||||
|
||||
public static function getByOrdCode($code)
|
||||
{
|
||||
return DB::select("SELECT * FROM t_orders_vehicles WHERE ord_code = ? LIMIT 1;", [$code]);
|
||||
}
|
||||
|
||||
public static function getByOrdCodeByStatus($code, $status)
|
||||
{
|
||||
return DB::select("SELECT * FROM t_orders_vehicles WHERE ord_code = ? AND status = ? LIMIT 1;", [$code, $status]);
|
||||
}
|
||||
|
||||
public static function getByOrdId($ordid)
|
||||
{
|
||||
return DB::select("SELECT * FROM t_orders_vehicles WHERE ord_id = ? LIMIT 1;", [$ordid]);
|
||||
}
|
||||
|
||||
public static function add($data)
|
||||
{
|
||||
$id = DB::table("t_orders_vehicles")->insertGetId($data);
|
||||
return $id;
|
||||
}
|
||||
|
||||
public static function updt($id, $data)
|
||||
{
|
||||
return DB::table("t_orders_vehicles")->where("id", $id)->update($data);
|
||||
}
|
||||
|
||||
public static function updtByOrdId($ord_id, $data)
|
||||
{
|
||||
return DB::table("t_orders_vehicles")->where("ord_id", $ord_id)->update($data);
|
||||
}
|
||||
|
||||
public static function dlt($id)
|
||||
{
|
||||
return DB::table("t_orders_vehicles")->where("id", $id)->delete();
|
||||
}
|
||||
|
||||
public static function dltByOrdId($ord_id)
|
||||
{
|
||||
return DB::table("t_orders_vehicles")->where("ord_id", $ord_id)->delete();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user