<?php

namespace Modules\Product\Models;

use Illuminate\Database\Eloquent\Model;
use Modules\Attribute\Models\Attribute;
use Modules\Option\Models\Option;
use Modules\Warehouse\Models\Warehouse;

class ProductWarehouse extends Model
{
    public $timestamps = false;

    protected $fillable =
        [
            'count',
            'cost',
            'discount_percentage',
            'attribute_id',
            'option_id',
            'warehouse_id',
            'product_id',
        ];

    public function warehouse()
    {
        return $this->belongsTo(Warehouse::class)->withTrashed();
    }

    public function product()
    {
        return $this->belongsTo(Product::class)->withTrashed();
    }

    public function option()
    {
        return $this->belongsTo(Option::class,'option_id')->withTrashed();
    }
    public function attribute()
    {
        return $this->belongsTo(Attribute::class,'attribute_id')->withTrashed();
    }

}
