hasMany(Product::class); } public function brands() { return $this->hasManyThrough(Brand::class, Subcategory::class, 'parent_id', 'subcategory_id'); } }