I have the following code snippet
$sectors = Sector::where('company_id', $id)
->where('status', '0')
->with('charges.levels')
->get();
I need 3 conditions
- sector status is 0
- charges status is 0
- Status of levels is 0
So I would like to know:
- How do I use a WHERE that looks for the status of charge 0 and the status of levels 0 being that they are in nested
with
:->with('charges.levels')
The code follows the hierarchy that:
- A sector has one or more positions and a position belongs to one sector only.
- A position has one or more levels and a level belongs to a position only.
Taking into account that I want to bring all levels where the level is status 0, position status 0 and sector status 0