/** * 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); }
/** * Flash Alert To The Session * * @param string $level * @param string $text * @return void */ public function flash($level, $text) { $this->session->setFlash('alerts.' . $level, $text); }