public function scopeWithMods($query, $modsArray) { return $query->where(function ($q) use($modsArray) { if (in_array('NM', $modsArray, true)) { $q->orWhere('enabled_mods', 0); } $bitset = ModsHelper::toBitset($modsArray); if ($bitset > 0) { $q->orWhereRaw('enabled_mods & ? != 0', [$bitset]); } }); }