Initial commit

This commit is contained in:
meusinfirmary
2025-04-22 14:33:37 +07:00
commit b9891d2f81
1305 changed files with 452033 additions and 0 deletions

50
app/Models/OrdersAccidents.php Executable file
View File

@ -0,0 +1,50 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class OrdersAccidents extends Model
{
public static function getAccidents()
{
return DB::select("SELECT * FROM t_orders_accidents WHERE dlt is null;");
}
public static function getAccidentById($id)
{
return DB::select("SELECT * FROM t_orders_accidents WHERE dlt is null AND id = ? LIMIT 1;", [$id]);
}
public static function getAccidentByOrdId($ord_id)
{
return DB::select("SELECT * FROM t_orders_accidents WHERE dlt is null AND ord_id = ? LIMIT 1;", [$ord_id]);
}
public static function addAccident($data)
{
$id = DB::table("t_orders_accidents")->insertGetId($data);
return $id;
}
public static function updateAccident($id, $data)
{
return DB::table("t_orders_accidents")->where("id", $id)->update($data);
}
public static function updateAccidentByOrdId($ord_id, $data)
{
return DB::table("t_orders_accidents")->where("ord_id", $ord_id)->update($data);
}
public static function deleteAccident($id)
{
return DB::table("t_orders_accidents")->where("id", $id)->delete();
}
public static function deleteAccidentByOrdId($ord_id)
{
return DB::table("t_orders_accidents")->where("ord_id", $ord_id)->delete();
}
}