public function actionDelete($id = null) { if (null === $id || null === ($model = ContentBlock::findOne($id))) { throw new NotFoundHttpException(); } if ($model->delete()) { Yii::$app->session->setFlash('info', Yii::t('app', 'Object removed')); } return $this->redirect(Yii::$app->request->get('returnUrl', Url::toRoute(['index']))); }