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