controllers/CrudController.php
public function actionDelete()
    {
        if ($this->findModel()->delete()) {
            \Yii::$app->getSession()->setFlash('success', $this->getFlashMsg('success'));;
        } else {
            \Yii::$app->getSession()->setFlash('error', $this->getFlashMsg('error'));
        }
        return $this->redirect(['index']);
    }
public function actionDelete()
    {
        if ($this->findModel()->delete()) {
            \Yii::$app->getSession()->setFlash('success', $this->getFlashMsg('success'));;
        } else {
            \Yii::$app->getSession()->setFlash('error', $this->getFlashMsg('error'));
        }
        return $this->redirect(['index']);
    }
public function actionDelete ( ) { if ( $ this -> findModel ( ) -> delete ( ) ) { \ Yii :: $ app -> getSession ( ) -> setFlash ( 'success' , $ this -> getFlashMsg ( 'success' ) ) ; ; } else { \ Yii :: $ app -> getSession ( ) -> setFlash ( 'error' , $ this -> getFlashMsg ( 'error' ) ) ; } return $ this -> redirect ( [ 'index' ] ) ; }
Deletes an existing target model.
If deletion is successful, the browser will be redirected to the 'index' page.
@return mixed
Deletes an existing target model . If deletion is successful the browser will be redirected to the index page .