where('server_id', $params['server_id']); } if (!empty($params['sdk_version'])) { $query->where('sdk_version', $params['sdk_version']); } if (!empty($params['game_id'])) { $query->where('game_id', $params['game_id']); } if (!empty($params['role_name'])) { $query->where('role_name', $params['role_name']); } if (!empty($params['server_name'])) { $query->where('server_name', $params['server_name']); } if (!empty($params['user_account'])) { $query->where('user_account', $params['user_account']); } if (!empty($params['role_id'])) { $query->where('role_id', $params['role_id']); } } public function scopeRangeRoleLevel($query, ?array $roleLevelRange) { if (is_null($roleLevelRange)) { return $query; } $min = $roleLevelRange[0] ?? null; $min == '' ? null : $min; $max = $roleLevelRange[1] ?? null; $max == '' ? null : $max; if (!is_null($min)) { $query->where('role_level', '>=', $min); } if (!is_null($max)) { $query->where('role_level', '<=', $max); } return $query; } }