<?php
namespace App\Models;
use Illuminate\Database\Eloquent\SoftDeletes;
class StockItem extends BaseModel {
    use SoftDeletes;
    public function unit() { return $this->belongsTo(Unit::class); }
    public function warehouse() { return $this->belongsTo(Warehouse::class, 'default_warehouse_id'); }
    public function ledgers() { return $this->hasMany(StockLedger::class, 'item_id'); }
    public function getDisplayNameAttribute(): string { return $this->code.' – '.$this->name; }
}
