<?php

namespace App\Models;

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

class Product extends Model
{
    use HasFactory;

    protected $fillable = [
        'ProductCode',
        'CategoryName',
        'ProductName',
        'SalePrice',
        'SupplierName',
        'ShortName',
        'ProductDescription',
        'Promotion'
    ];


    // Define a one-to-many relationship with AppOrderItem
    public function orderItems()
    {
        return $this->hasMany(AppOrderItem::class, 'ProductCode', 'ProductCode');
    }

    public function customerPricing()
    {
        return $this->hasMany(CustomerPricing::class, 'ProductNo', 'ProductCode');
    }
}