<?php

namespace App\Models\AdminModels;

use Illuminate\Database\Eloquent\Model;

class Category extends Model
{
    protected $fillable = ['name', 'status', 'order', 'parent_id'];
    
    public function children()
    {
        return $this->hasMany(Category::class, 'parent_id')->orderBy('order');
    }
    public function sub_category(){
        return $this->hasMany(SubCategory::class, 'category_id','id');
    }
}
