<?php

namespace App\Models;

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

class PosInvoiceDetail extends Model
{
    use HasFactory;

    protected $fillable = ['item_reference_id','point', 'invoice_id', 'item_id','item_variant_id','note','qty','unit_price','unit','reference','discount','vat','total','unit_cost','line_no',
        'description','item_number','variant_code','invoice_discount', 'line_discount', 'net_price', 'pricelist_discount','serial_number'
        ];

    public function itemReference()
    {
        return $this->belongsTo(ItemReference::class);
    }

    public function item()
    {
        return $this->belongsTo(Items::class);
    }

    public function itemVariant()
    {
        return $this->belongsTo(ItemVariant::class);
    }

    public function invoice()
    {
        return $this->belongsTo(PosInvoice::class, 'invoice_id');
    }
}
