<?php

namespace App\Models;

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

class OrderItem extends Model
{
    use HasFactory;

    protected $fillable = [
        'order_id',
        'description',
        'ctn',
        'qty',
        'ttl_qty',
        'unit',
        'price',
        'ttl_amount',
        'cbm',
        'ttl_cbm',
        'kg',
        'ttl_kg',
        'shop_no',
        'meta',
    ];

    protected $casts = [
        'meta' => 'array',
    ];

    // Link to parent order
    public function order()
    {
        return $this->belongsTo(Order::class);
    }
}
