I have the following code:
$sectors = Sector::where('company_id', $id)
->where('status', '0')
->with('charges.levels')
->get();
and I need 3 conditions
- Status of sector be 0
- Status of charges be 0
- Status of levels be 0
So I wanna know:
- How to use a WHERE that search the status of charges 0 and the status of levels 0 when they are in a nested with: ->with('charges.levels')
The code have the following relationships:
- A sector has many charges and a charge belongs to a sector
- A charge has many levels and a level belongs to a charge
So, I wanna bring all levels where status of level is 0, status of charge is 0 and the status of sector is 0