Fix required

This commit is contained in:
Maxime 2019-09-03 18:05:56 +02:00
parent 161741cc9e
commit ad1e26fb14
1 changed files with 2 additions and 1 deletions

View File

@ -273,7 +273,8 @@ class Validator
{
foreach ($this->rules as $field => $rules)
{
$nullable = !in_array('required', $rules) && !in_array('required_file', $rules) && !in_array('required_files', $rules);
$rules_names = array_map(function($rule) { return $rule['rule']; }, $rules);
$nullable = !in_array('required', $rules_names) && !in_array('required_file', $rules_names) && !in_array('required_files', $rules_names);
foreach ($rules as $rule) $this->test($field, $rule, $nullable);
}