where(fn($q)=> $q->where('services.active',TRUE) ->orWhere(fn($q)=> $q->whereNotNull('order_status') ->whereNotIn('services.order_status',Service::INACTIVE_STATUS)) ); } public function scopeServiceInactive($query) { return $query ->where(fn($q)=> $q->where('services.active',FALSE) ->orWhere(fn($q)=> $q->whereNotNull('order_status') ->whereIn('services.order_status',Service::INACTIVE_STATUS)) ); } }