protected function generateFilter($request)
    {
        $this->filters[$this->usernameField] = trim($request->input($this->usernameField));
        foreach ($this->otherFields as $of) {
            $of = trim($of);
            $this->filters[$of] = $request->input($of);
        }

        $string = '';
        $multiple = 0;
        foreach ($this->filters as $f => $v) {
            if (!empty($string)) {
                $string .= " AND ";
                $multiple = 1;
            }
            if (is_bool($v) || 'true' === strtolower($v) || 'false' === strtolower($v)) {
                if ($v === true || $v === 'true') {
                    $v = 1;
                } else {
                    $v = 0;
                }
            }
            $string .= "($f=$v)";
        }

        return ($multiple) ? "(" . $string . ")" : $string;
    }