I have a nested relationship that I want to set a condition and a limit.
$data = Accommodation::with('accommodationFacilities', 'city')
    ->take(10)
    ->with('accommodationRooms.roomPricingHistory')
    ->limit(2)
    ->where('is_deleted', 0)
    ->paginate(10);
Now I have a nested relation on line 2 that I want to limit this relation by: roomPricingHistory.
The code limits the parent relation which is: accommodationRooms.
Any idea how I can limit the child relation and how can I set an if for it so if a column is === 0 this row should be loaded.
 
     
    