/** * Deletes an existing Custofixo model. * If deletion is successful, the browser will be redirected to the 'index' page. * @param integer $id * @return mixed */ public function actionDelete($id) { //Guarda a mensagem $mensagem = ""; $transaction = \Yii::$app->db->beginTransaction(); try { if ($this->findModel($id)->delete()) { $transaction->commit(); } } catch (\Exception $exception) { $transaction->rollBack(); $mensagem = "Ocorreu uma falha inesperada ao tentar salvar "; } $searchModel = new CustofixoSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'mensagem' => $mensagem]); }