Created
October 3, 2013 17:07
-
-
Save hugofabricio/6813288 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Painel Delete | |
| */ | |
| public function painel_delete($id = null) | |
| { | |
| // Prova | |
| $this->Task->id = $id; | |
| // Se o registro não for encontrado | |
| if (!$this->Task->exists()): | |
| throw new NotFoundException('Prova não encontrada.'); | |
| endif; | |
| // Se existir efetua a ação de exclusão | |
| if ($this->Task->delete()): | |
| $this->Session->setFlash('Excluído com sucesso.', SUCCESS); | |
| $this->redirect(array('action' => 'index', 'painel' => true)); | |
| endif; | |
| // Mensagem de erro | |
| $this->Session->setFlash('Falha ao excluir.', WARNING); | |
| // Redireciona | |
| $this->redirect(array('action' => 'index', 'painel' => true)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment