public function actionDelete($id = null) { if (null === $id || null === ($model = View::findOne($id))) { throw new NotFoundHttpException(); } if (!$model->delete()) { Yii::$app->session->setFlash('error', Yii::t('app', 'Object not removed')); } else { Yii::$app->session->setFlash('info', Yii::t('app', 'Object removed')); } return $this->redirect(Url::toRoute('index')); }
public function down() { $default_view = \app\models\View::findOne(['id' => 1]); $default_view->view = 'show'; $default_view->save(); }