<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class AppOrderItem extends Model
{
    protected $fillable = [
        'app_order_id',
        'ProductCode',
        'ProductName',
        'ProductPrice',
        'Quantity',
        'SubTotal',
    ];

    // Define a many-to-one (inverse of one-to-many) relationship with Product
    public function product()
    {
        return $this->belongsTo(Product::class, 'ProductCode', 'ProductCode');
    }

    // Define a many-to-one relationship with AppOrder
    public function appOrder()
    {
        return $this->belongsTo(AppOrder::class);
    }


}
