Commit 5974a58b authored by Han Lin Yap's avatar Han Lin Yap

validate ip

parent a36e2773
...@@ -427,6 +427,18 @@ class Validator { ...@@ -427,6 +427,18 @@ class Validator {
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.
* *
......
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