Merge pull request #278 from codler/patch-8

Validate IP
This commit is contained in:
Taylor Otwell 2012-01-29 11:54:48 -08:00
commit af5e4c6be6
1 changed files with 12 additions and 0 deletions

View File

@ -434,6 +434,18 @@ protected function validate_unique($attribute, $value, $parameters)
return $query->count() == 0; return $query->count() == 0;
} }
/**
* Validate that an attribute is a valid IP.
*
* @param string $attribute
* @param mixed $value
* @return bool
*/
protected function validate_ip($attribute, $value)
{
return filter_var($value, FILTER_VALIDATE_IP) !== false;
}
/** /**
* Validate that an attribute is a valid e-mail address. * Validate that an attribute is a valid e-mail address.