where(function($q) { return $q->where('services.active',TRUE) ->orWhere(function($q) { return $q->whereNotNull('order_status') ->whereNotIn('services.order_status',Service::INACTIVE_STATUS); }); }); } }