Created
January 26, 2016 13:23
-
-
Save hmic/8b66418062eccba1dfd0 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
public function initialize() { | |
// ... | |
$this->loadModel('Historico'); | |
// ... | |
} | |
public function add() | |
{ | |
$solicitud = $this->Solicitud->newEntity(); | |
if ($this->request->is('post')) { | |
$data = [ | |
'estado' => '1', | |
'observaciones' => 'por fin', | |
'solicitud' => '1', | |
'usuario' => 'lina' | |
]; | |
$entity = $this->Historico->newEntity($data); | |
$this->Historico->save($entity); | |
$solicitud = $this->Solicitud->patchEntity($solicitud, $this->request->data); | |
if ($this->Solicitud->save($solicitud)) { | |
$this->Flash->success(__('La Solicitud ha sido Creada con Exito.')); | |
return $this->redirect(['action' => 'index']); | |
} else { | |
$this->Flash->error(__('La Solicitud no se puede Crear. Por favor, intentelo de nuevo.')); | |
} | |
} | |
$this->set(compact('solicitud')); | |
$this->set('_serialize', ['solicitud']); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment