<?php

namespace App\Model\product;

use Illuminate\Database\Eloquent\Model;

class ProductUnitModel extends Model
{
    protected $table = 'nso007_product_unit';
    protected $fillable = [
        'product_id',
        'unit_id',
        'size_code',
        'color_code',
        'cost_usd',
        'cost_riel',
        'price_riel',
        'price_usd',
        'qty_per_unit',
        'tailor_price_riel',
        'tailor_price_usd',
        'type',
        'barcode',
        ];
    public function size()
    {
        return $this->hasOne(SizeModel::class,'code','size_code');
    }
    public function color()
    {
        return $this->hasOne(ColorModel::class,'code','color_code');
    }
    public function product()
    {
        return $this->belongsTo(ProductModel::class,'product_id','id');
    }
}
