<?php

namespace App\Models;

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

class CustomerAdvancePaymentDetail 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');
    }

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

    public function master()
    {
        return $this->belongsTo(CustomerAdvancePaymentMaster::class, 'advance_payment_master_id', 'id');
    }
}
