<?php

namespace App\Models;

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

class UsedProductDetails extends BaseModel
{
    use HasFactory;

    protected $guarded = [];

    public function attribute()
    {
        return $this->hasOne(productAttribute::class, 'id', 'attribute_id')
            ->with('product', 'color', 'unit', 'brand', 'model', 'size', 'warehouse', 'origin', 'shopOpening', 'goldUnit', 'diamondUnit');
    }

    public function product()
    {
        return $this->hasOne(Product::class, 'id', 'product_id');
    }

    public function stock()
    {
        return $this->hasOne(WarehouseStock::class, 'attribute_id', 'attribute_id');
    }
}
