<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Support\Facades\DB;

class UomCategory extends Model
{
    use HasFactory;

    protected $table = 'uom_categories';
    protected $fillable = ['code', 'description'];

    // Static update method (optional)
    public static function updateUomCategory($id, $code, $description)
    {
        return DB::update(
            "UPDATE uom_categories SET code = ?, description = ? WHERE id = ?",
            [$code, $description, $id]
        );
    }

    // Static delete method (optional)
    public static function deleteUomCategory($id)
    {
        return DB::delete("DELETE FROM uom_categories WHERE id = ?", [$id]);
    }
}
