Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
Chris Berthe
2012-07-12 11:15:43 -04:00
25 changed files with 538 additions and 44 deletions

View File

@@ -214,7 +214,7 @@ class Validator {
*/
protected function implicit($rule)
{
return $rule == 'required' or $rule == 'accepted';
return $rule == 'required' or $rule == 'accepted' or $rule == 'required_with';
}
/**
@@ -257,6 +257,27 @@ class Validator {
return true;
}
/**
* Validate that an attribute exists in the attributes array, if another
* attribute exists in the attributes array.
*
* @param string $attribute
* @param mixed $value
* @param array $parameters
* @return bool
*/
protected function validate_required_with($attribute, $value, $parameters)
{
$other = $parameters[0];
if ($this->validate_required($other, $this->attributes[$other]))
{
return $this->validate_required($attribute, $value);
}
return true;
}
/**
* Validate that an attribute has a matching confirmation attribute.
*