fix bug in validator class required check.
This commit is contained in:
@@ -137,7 +137,17 @@ class Validator {
|
||||
*/
|
||||
protected function validate_required($attribute)
|
||||
{
|
||||
return array_key_exists($attribute, $this->attributes) and trim($this->attributes[$attribute]) !== '';
|
||||
if ( ! array_key_exists($attribute, $this->attributes))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (is_string($this->attributes[$attribute]) and trim($this->attributes[$attribute]) === '')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user