Skip to content

Instantly share code, notes, and snippets.

@braulioholtz
Created May 5, 2014 02:41
Show Gist options
  • Save braulioholtz/3a165ecdbe01160c7d55 to your computer and use it in GitHub Desktop.
Save braulioholtz/3a165ecdbe01160c7d55 to your computer and use it in GitHub Desktop.
ClientesController.php
if ($this->request->is('post') || $this->request->is('put')) {
if ($this->Cliente->save($this->request->data)) {
$this->Cliente->saveAssociated($this->request->data);
$this->Session->setFlash('O cliente foi editado com sucesso!',
'alert', array( 'plugin' => 'BoostCake', 'class' => 'alert-success' ));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash('O cliente não foi editado. Tente novamente.', 'alert', array(
'plugin' => 'BoostCake', 'class' => 'alert-error'
));
}
} else {
$this->request->data = $this->Cliente->read();
$this->set('clientes', $this->Cliente->read());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment