<?php

namespace App\Models;

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

class MiscReceiptItem extends Model
{
    use HasFactory;

    protected $table = 'misc_receipt_items';

    protected $fillable = [
        "misc_receipt_id",
        "item_id",
        "item_code_snapshot",
        "item_name_snapshot",
        "quantity",
        "unit_cost",
    ];

    public function miscReceipt()
    {
        return $this->belongsTo(MiscReceipt::class, "misc_receipt_id", "id");
    }

    public function item()
    {
        return $this->belongsTo(Item::class, "item_id", "id");
    }
}
