Commit 45ee387f by Thiago Talma Committed by Qiang Xue

It is not required by default when you set the "when" attribute

parent 83b80027
...@@ -442,7 +442,7 @@ class Model extends Component implements IteratorAggregate, ArrayAccess, Arrayab ...@@ -442,7 +442,7 @@ class Model extends Component implements IteratorAggregate, ArrayAccess, Arrayab
public function isAttributeRequired($attribute) public function isAttributeRequired($attribute)
{ {
foreach ($this->getActiveValidators($attribute) as $validator) { foreach ($this->getActiveValidators($attribute) as $validator) {
if ($validator instanceof RequiredValidator) { if ($validator instanceof RequiredValidator && !$validator->when) {
return true; 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