<?php

namespace App\Models;

use App\Models\BaseModel;

class Uom extends BaseModel
{
    protected $table = 'uoms';

    protected $fillable = ['company_id', 'code', 'name', 'is_active'];

    protected $casts = ['is_active' => 'boolean'];

    public function company() { return $this->belongsTo(Company::class); }
    public function items()   { return $this->hasMany(Item::class, 'uom_id'); }

    public function scopeActive($q) { return $q->where('is_active', true); }
}
