<?php

namespace App\Models\Warehouse;

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

class TransferOrderItem extends Model
{
    use HasFactory;

    protected $fillable = [
        'transfer_order_id',
        'product_id',
        'quantity',
    ];

    protected $casts = [
        'quantity' => 'integer',
    ];

    /**
     * 所屬調撥單
     */
    public function transferOrder()
    {
        return $this->belongsTo(TransferOrder::class);
    }

    /**
     * 對應商品
     */
    public function product()
    {
        return $this->belongsTo(\App\Models\Product\Product::class);
    }
}
