I have a category model with a subcategory relationship. I need to get all categories in which all subcategories have the active status. Please help me to form a query
I did
$query->whereHas('subcategory', function($query) {
query->where('subcategory.status', '=', 'passed');
});
but this query returns categories in which at least one subcategory is active, but I need all subcategories to be stranded, the status is active
public function subcategory() { return $this->hasMany(CategorySubcategory::class, 'category_id'); }
– Юлий Реут