<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class FabricationOrder extends Model
{
    protected $guarded = ['id'];

    public function branch() {
        return $this->belongsTo(Branch::class);
    }

    public function formula() {
        return $this->belongsTo(FabricationFormula::class, 'fabrication_formula_id');
    }

    public function user() {
        return $this->belongsTo(User::class);
    }

    public function materialsUsed() {
        return $this->hasMany(FabricationOrderMaterial::class);
    }
}