/** * Store * * @return void */ public function store() { if ($this->validator->fails()) { return $this->app->response->redirect('session/create'); } if ($this->auth->attempt($this->app->request->all())) { return $this->app->response->redirect('page/home'); } $this->app->alert->flash('danger', "Your credentials could not be verified."); return $this->app->response->redirect('session/create'); }
/** * Update * * @param integer $id * @return Response */ public function update($id) { // redirect back to the form if validation fails if ($this->validator->fails()) { return $this->app->response->redirect('bondservant/edit/' . $id); } // update the database $result = $this->bondservant->update($id, array('name' => $this->app->request->get('name'), 'rating' => $this->app->request->get('rating'), 'deleted' => $this->app->request->get('deleted'))); // flash alert and redirect to index $this->app->alert->flash('success', "Bondservant #{$id} was successfully updated."); return $this->app->response->redirect('bondservant/index'); }