<?php

namespace App\Modules\Production\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;


class RecipeItem extends Model
{
    use HasFactory;

    protected $fillable = [
        'recipe_id',
        'product_id',
        'quantity',
        'unit_id',
        'remark',
    ];

    protected $casts = [
        'quantity' => 'decimal:4',
    ];

    public function recipe()
    {
        return $this->belongsTo(Recipe::class);
    }

    public function product()
    {
        return $this->belongsTo(\App\Modules\Inventory\Models\Product::class);
    }

    public function unit()
    {
        return $this->belongsTo(\App\Modules\Inventory\Models\Unit::class);
    }
}
