<?php

namespace App\Models;

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

class ProductRelation extends Model
{
    use HasFactory;

    protected $fillable = [
        'product_id',
        'product_category_id',
        'product_sub_category_id',
        'industry_id',
        'sub_industry_id',
        'user_id'
    ];


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

    public function category()
    {
        return $this->belongsTo(ProductCategory::class, 'product_category_id');
    }

    public function subCategory()
    {
        return $this->belongsTo(ProductSubCategory::class, 'product_sub_category_id');
    }

    public function industry()
    {
        return $this->belongsTo(Industry::class);
    }

    public function subIndustry()
    {
        return $this->belongsTo(SubIndustry::class);
    }
}