<?php

namespace App;

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

class ProductCategory extends BaseModel
{
    use HasFactory;

    protected $table = 'product_categories';

    protected $fillable = [
        'id', 'name', 'slug', 'description', 'parent_id',
        'is_activated', 'is_deleted', 'created_at', 'updated_at'
    ];

    public function parent() {
        return $this->belongsTo(ProductCategory::class, 'parent_id', 'id')->with('parent')->select('id', 'name', 'slug', 'parent_id')->where('is_deleted', false);
    }
}
