I have a category module in a hierarchy. I need to query that category by checking if any one of the parents should not be inactive(false).
For example
- First category (inactive or false) 1.1 > First Category Child 1.1.1> First Category Grand Child
My Query
$category = Category::where('status',true)->where('title','like','%'.$keywords.'%')->paginate(10);
This query only checks if its status is true or false. But i need to check status of its parent level as well. So, is there a way to check parent level status as well inside the query. The category may have parent or maynot have parent as well. So, because of this whereHas('parents') doesn't work.