<?php
namespace App\Models;
use Illuminate\Database\Eloquent\SoftDeletes;
class Product extends BaseModel {
    use SoftDeletes;
    public function category() { return $this->belongsTo(ProductCategory::class, 'category_id'); }
    public function unit() { return $this->belongsTo(Unit::class); }
    public function stockpiles() { return $this->hasMany(Stockpile::class); }
    public function getDisplayNameAttribute(): string { return $this->code.' – '.$this->name; }
}
