added support for custom validation lines.

This commit is contained in:
Taylor Otwell
2012-02-01 10:11:27 -06:00
parent a9873a479d
commit eaa2cf593c
2 changed files with 42 additions and 19 deletions

View File

@@ -604,9 +604,15 @@ class Validator {
// First we'll check for developer specified, attribute specific messages.
// These messages take first priority. They allow the fine-grained tuning
// of error messages for each rule.
if (array_key_exists($attribute.'_'.$rule, $this->messages))
$custom = $attribute.'_'.$rule;
if (array_key_exists($custom, $this->messages))
{
return $this->messages[$attribute.'_'.$rule];
return $this->messages[$custom];
}
elseif (Lang::has($custom = "validation.custom.{$custom}", $this->language))
{
return Lang::line($custom)->get($this->language);
}
// Next we'll check for developer specified, rule specific error messages.