/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Nota(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Nota'])) { $model->attributes = $_POST['Nota']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }
public function actionCadastrar() { if ($this->request->isPostRequest) { $cadastrarNota = new Nota(); $cadastrarNota->descricao = $this->request->getPost('descricao'); $cadastrarNota->situacao = $this->resquest->getPost('situacao'); $cadastrarNota->topico_id = $this->resquet->getPost('topico_id'); $cadastrarNota->dt_criacao = date('Y-m-d'); if ($cadastrarNota->save()) { $this->user->setFlash('success', 'Esta nota foi criad com sucesso.'); $this->redirect(['nota/novaNota']); } else { $this->user->setFlash('error', 'Error ao cadastrar esta nota, verifique se está tudo correto!'); } } }