public function validate($field, array $attributes = array())
    {
        foreach ($this->validator->rules($field) as $validate => $param) {
            $attributes["data-rule-{$validate}"] = htmlspecialchars($param);
        }
        foreach ($this->validator->messages($field) as $rule => $message) {
            $attributes["data-msg-{$rule}"] = htmlspecialchars($message);
        }

        return $attributes;
    }