fix bug in validator class required check.
This commit is contained in:
parent
49cd851f54
commit
e9a43326a7
|
@ -137,7 +137,17 @@ protected function check($attribute, $rule)
|
|||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue