Skip to content
This repository
Browse code

Adding support for "last" rule in `Validator::check` method

  • Loading branch information...
commit afe30c71a60809a2a18c7c56c2f7bc3d99996628 1 parent 1281928
Veselin vesln authored

Showing 1 changed file with 6 additions and 1 deletion. Show diff stats Hide diff stats

  1. +6 1 util/Validator.php
7 util/Validator.php
@@ -430,7 +430,8 @@ public static function check(array $values, array $rules, array $options = array
430 430 'required' => true,
431 431 'skipEmpty' => false,
432 432 'format' => 'any',
433   - 'on' => null
  433 + 'on' => null,
  434 + 'last' => false
434 435 );
435 436 $errors = array();
436 437 $events = (array) (isset($options['events']) ? $options['events'] : null);
@@ -460,6 +461,10 @@ public static function check(array $values, array $rules, array $options = array
460 461 }
461 462 if (!static::rule($name, $values[$field], $rule['format'], $rule + $options)) {
462 463 $errors[$field][] = $rule['message'] ?: $key;
  464 +
  465 + if ($rule['last']) {
  466 + break;
  467 + }
463 468 }
464 469 }
465 470 }

0 comments on commit afe30c7

Please sign in to comment.
Something went wrong with that request. Please try again.