all() public method

Get all of the messages for every key in the bag.
public all ( string $format = null ) : array
$format string
return array
示例#1
0
 /**
  * Get the message container for the validator.
  *
  *
  * @return \Overtrue\Support\MessageBag
  */
 public function messages()
 {
     if (!$this->messages) {
         $this->passes();
     }
     return $this->messages->all();
 }
示例#2
0
 /**
  * Determine if the data passes the validation rules.
  *
  *
  * @return bool
  */
 public function passes()
 {
     $this->messages = new MessageBag();
     // We'll spin through each rule, validating the attributes attached to that
     // rule. Any error messages will be added to the containers with each of
     // the other error messages, returning true if we don't have messages.
     foreach ($this->rules as $attribute => $rules) {
         foreach ($rules as $rule) {
             $this->validate($attribute, $rule);
         }
     }
     // Here we will spin through all of the "after" hooks on this validator and
     // fire them off. This gives the callbacks a chance to perform all kinds
     // of other validation that needs to get wrapped up in this operation.
     foreach ($this->after as $after) {
         call_user_func($after);
     }
     return count($this->messages->all()) === 0;
 }