Commit dae28394 by Taylor Otwell

refactor the validate required method for clarity.

parent d9330167
......@@ -211,7 +211,20 @@ class Validator {
*/
protected function validate_required($attribute, $value)
{
return ! (is_null($value) or (is_string($value) and trim($value) === ''));
if (is_null($value))
{
return false;
}
elseif (is_string($value) and trim($value) === '')
{
return false;
}
elseif (is_array($value) and count($value) == 0)
{
return false;
}
return true;
}
/**
......
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