* * @version 1.0.0 */ class UnitOfMeasurement extends Model { protected $table = 'units_of_measurement'; protected $fillable = [ 'name', 'abbreviation', 'allows_decimals', 'is_active', ]; protected $casts = [ 'allows_decimals' => 'boolean', 'is_active' => 'boolean', ]; /** * Scope para unidades activas */ public function scopeActive($query) { return $query->where('is_active', true); } /** * Relación con inventarios */ public function inventories() { return $this->hasMany(Inventory::class, 'unit_of_measure_id'); } }