So if the checkbox is checked you want to add a whereHas on listings?
$projects = projects::with('builder','city','locality')
->where('project_city', $city)
->when($checked, function($q) {
$q->whereHas('listings', function ($q) {
$q->where('dealstatus', 'open');
}) ;
})
->withCount('reviews')
->orderByDesc('reviews_count')
->paginate(10)
->withQueryString();