Commit 4f560fdf authored by Taylor Otwell's avatar Taylor Otwell

continuing to refactor the validator.

parent 6f366d30
...@@ -2,28 +2,33 @@ ...@@ -2,28 +2,33 @@
return array( return array(
"accepted" => "The :attribute must be accepted.", "accepted" => "The :attribute must be accepted.",
"active_url" => "The :attribute is not a valid URL.", "active_url" => "The :attribute is not a valid URL.",
"alpha" => "The :attribute may only contain letters.", "alpha" => "The :attribute may only contain letters.",
"alpha_dash" => "The :attribute may only contain letters, numbers, and dashes.", "alpha_dash" => "The :attribute may only contain letters, numbers, and dashes.",
"alpha_num" => "The :attribute may only contain letters and numbers.", "alpha_num" => "The :attribute may only contain letters and numbers.",
"between" => "The :attribute must be between :min - :max.", "between" => "The :attribute must be between :min - :max.",
"confirmed" => "The :attribute confirmation does not match.", "between.file" => "The :attribute must be between :min - :max kilobytes.",
"email" => "The :attribute format is invalid.", "between.string" => "The :attribute must be between :min - :max characters.",
"image" => "The :attribute must be an image.", "confirmed" => "The :attribute confirmation does not match.",
"in" => "The selected :attribute is invalid.", "email" => "The :attribute format is invalid.",
"integer" => "The :attribute must be an integer.", "image" => "The :attribute must be an image.",
"max" => "The :attribute must be less than :max.", "in" => "The selected :attribute is invalid.",
"mimes" => "The :attribute must be a file of type: :values.", "integer" => "The :attribute must be an integer.",
"min" => "The :attribute must be at least :min.", "max" => "The :attribute must be less than :max.",
"not_in" => "The selected :attribute is invalid.", "max.file" => "The :attribute must be less than :max kilobytes.",
"numeric" => "The :attribute must be a number.", "max.string" => "The :attribute must be less than :max characters.",
"required" => "The :attribute field is required.", "mimes" => "The :attribute must be a file of type: :values.",
"size" => "The :attribute must be :size.", "min" => "The :attribute must be at least :min.",
"unique" => "The :attribute has already been taken.", "min.file" => "The :attribute must be at least :min kilobytes.",
"url" => "The :attribute format is invalid.", "min.string" => "The :attribute must be at least :min characters.",
"not_in" => "The selected :attribute is invalid.",
"characters" => "characters", "numeric" => "The :attribute must be a number.",
"kilobytes" => "kilobytes", "required" => "The :attribute field is required.",
"size" => "The :attribute must be :size.",
"size.file" => "The :attribute must be :size kilobyte.",
"size.string" => "The :attribute must be :size characters.",
"unique" => "The :attribute has already been taken.",
"url" => "The :attribute format is invalid.",
); );
\ No newline at end of file
...@@ -515,20 +515,15 @@ class Validator { ...@@ -515,20 +515,15 @@ class Validator {
{ {
return $this->messages[$rule]; 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 else
{ {
$message = Lang::line('validation.'.$rule)->get($this->language); return 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;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment