<?php

namespace App\Models;

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

class LeftOverNoteItem extends Model
{
    use HasFactory;

    protected $fillable = [
        'left_over_note_id',
        'raw_material_item_id',
        'quantity',
        'unit',
        'unit_price',
        'total',
        'remarks',
        'sir_item_id',
        'sir_id',
        'sir_item_qty'
    ];

    public function rawMaterialItem()
    {
        return $this->belongsTo(RawMaterialItem::class);
    }

    public function leftOverNote()
    {
        return $this->belongsTo(LeftOverNote::class);
    }

    public function sir()
    {
        return $this->belongsTo(StoreIssueRequisition::class, 'sir_id');
    }

    public function sirItem()
    {
        return $this->belongsTo(StoreIssueRequisitionItem::class, 'sir_item_id');
    }
}
