added error type to validation rule.

This commit is contained in:
Taylor Otwell
2011-06-26 16:17:41 -05:00
parent 2289570c95
commit bd3d8f6347
3 changed files with 26 additions and 7 deletions

View File

@@ -61,16 +61,19 @@ class Size_Of extends Rule {
{
if ( ! is_null($this->length) and $attributes[$attribute] !== $this->length)
{
$this->error = 'number_wrong_size';
return false;
}
if ( ! is_null($this->maximum) and $attributes[$attribute] > $this->maximum)
{
$this->error = 'number_too_big';
return false;
}
if ( ! is_null($this->minimum and $attributes[$attribute] < $this->minimum))
{
$this->error = 'number_too_small';
return false;
}
@@ -90,16 +93,19 @@ class Size_Of extends Rule {
if ( ! is_null($this->length) and Str::length($value) !== $this->length)
{
$this->error = 'string_wrong_size';
return false;
}
if ( ! is_null($this->maximum) and Str::length($value) > $this->maximum)
{
$this->error = 'string_too_big';
return false;
}
if ( ! is_null($this->minimum) and Str::length($value) < $this->minimum)
{
$this->error = 'string_too_small';
return false;
}