63 lines
1.5 KiB
PHP
Executable File
63 lines
1.5 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class OrdersClients extends Model
|
|
{
|
|
|
|
const IS_NON_PKP = 0;
|
|
const IS_PKP_YES = 1;
|
|
|
|
const IS_NOT_PAY = 1;
|
|
const IS_PAYED = 2;
|
|
|
|
public static function get()
|
|
{
|
|
return DB::select("SELECT * FROM t_orders_clients;");
|
|
}
|
|
|
|
public static function getById($id)
|
|
{
|
|
return DB::select("SELECT * FROM t_orders_clients WHERE id = ? LIMIT 1;", [$id]);
|
|
}
|
|
|
|
public static function getByOrdCode($code)
|
|
{
|
|
return DB::select("SELECT * FROM t_orders_clients WHERE ord_code = ? LIMIT 1;", [$code]);
|
|
}
|
|
|
|
public static function getByOrdId($ordid)
|
|
{
|
|
return DB::select("SELECT * FROM t_orders_clients WHERE ord_id = ? LIMIT 1;", [$ordid]);
|
|
}
|
|
|
|
public static function add($data)
|
|
{
|
|
$id = DB::table("t_orders_clients")->insertGetId($data);
|
|
return $id;
|
|
}
|
|
|
|
public static function updt($id, $data)
|
|
{
|
|
return DB::table("t_orders_clients")->where("id", $id)->update($data);
|
|
}
|
|
|
|
public static function updtByOrdId($ord_id, $data)
|
|
{
|
|
return DB::table("t_orders_clients")->where("ord_id", $ord_id)->update($data);
|
|
}
|
|
|
|
public static function dlt($id)
|
|
{
|
|
return DB::table("t_orders_clients")->where("id", $id)->delete();
|
|
}
|
|
|
|
public static function dltByOrdId($ord_id)
|
|
{
|
|
return DB::table("t_orders_clients")->where("ord_id", $ord_id)->delete();
|
|
}
|
|
}
|