public function gravarAction() { $id = $this->_getParam('id', null); $sala = new Sala(); $dados = $this->_getAllParams(); if ($id) { $rowSala = $sala->find($id)->current(); } else { $rowSala = $sala->createRow(); unset($dados['id']); } $rowSala->setFromArray($dados); try { $rowSala->save(); } catch (Exception $e) { echo '<pre>Exception: '; print_r($e); echo '</pre>'; echo '<pre>Data: '; print_r($rowSala); echo '</pre>'; exit; } $this->_redirect('salas/index'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $this->sala->find($id)->delete(); return Redirect::route('admin.salas.index'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($idSala) { $sala = Sala::find($idSala); $sala->delete(); return Response::json(array('error' => false, 'message' => 'Sala eliminada'), 200); }