diff --git a/laravel/validator.php b/laravel/validator.php index 22f3a406..535ff9f5 100644 --- a/laravel/validator.php +++ b/laravel/validator.php @@ -434,6 +434,18 @@ protected function validate_unique($attribute, $value, $parameters) 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.