Example #1
0
 /**
  * Validate The Request
  *
  * @todo we're only applying one rule per key at this point
  * @return void
  */
 protected function validate()
 {
     foreach ($this->rules as $key => $rule) {
         if (isset($this->input[$key]) and $error = $this->{$rule}($key, $this->input[$key])) {
             $this->errors[$key] = $error;
         }
     }
     if ($this->errors) {
         $this->session->setFlash('alerts.danger', 'Errors were found in your form submission.');
         $this->session->setFlash('errors', $this->errors());
         $this->session->setFlash('old_input', $this->input);
     }
     return empty($this->errors);
 }
Example #2
0
 /**
  * Get All Flashed Alerts
  *
  * @return array
  */
 public function all()
 {
     return $this->session->getFlash('alerts', array());
 }