continuing to refactor the validator.

This commit is contained in:
Taylor Otwell
2011-10-16 14:19:54 -05:00
parent 6f366d3010
commit 4f560fdf5c
2 changed files with 35 additions and 35 deletions

View File

@@ -515,20 +515,15 @@ class Validator {
{
return $this->messages[$rule];
}
elseif (in_array($rule, $this->size_rules) and ! $this->has_rule($attribute, $this->numeric_rules))
{
$line = (array_key_exists($attribute, Input::file())) ? "file" : "string";
return Lang::line("validation.{$rule}.{$line}")->get($this->language);
}
else
{
$message = Lang::line('validation.'.$rule)->get($this->language);
// For "size" rules that are validating strings or files, we need to adjust
// the default error message for the appropriate units.
if (in_array($rule, $this->size_rules) and ! $this->has_rule($attribute, $this->numeric_rules))
{
return (array_key_exists($attribute, Input::file()))
? rtrim($message, '.').' '.Lang::line('validation.kilobytes')->get($this->language).'.'
: rtrim($message, '.').' '.Lang::line('validation.characters')->get($this->language).'.';
}
return $message;
return Lang::line("validation.{$rule}")->get($this->language);
}
}