<?php
namespace App\Models;
use Illuminate\Database\Eloquent\SoftDeletes;
class Equipment extends BaseModel {
    use SoftDeletes;
    protected function casts(): array { return ['purchase_date' => 'date']; }
    public function quarry() { return $this->belongsTo(Quarry::class, 'current_quarry_id'); }
    public function project() { return $this->belongsTo(Project::class, 'current_project_id'); }
    public function documents() { return $this->hasMany(EquipmentDocument::class); }
    public function workOrders() { return $this->hasMany(MaintenanceWorkOrder::class); }
    public function getDisplayNameAttribute(): string { return $this->code.' – '.$this->name; }
}
