controllers/AdminController.php
public function actionDelete($id)
    {
        $model = $this->findModel($id);

        $model->orderBy = $model::$defaultOrderBy;
        $model->page = $model->calcPage($model::find()->where(['parent_id' => $model->parent_id]));
        $returnTo = ['index', // try to return to same place - deletion may be unsuccessfull
            'parent_id' => $model->parent_id,
            'page'      => $model->page,
            'id'        => $id,
            'sort'      => $model->orderByToSort(),
        ];

        $model->delete();

        return $this->redirect($returnTo);
    }
public function actionDelete($id)
    {
        $model = $this->findModel($id);

        $model->orderBy = $model::$defaultOrderBy;
        $model->page = $model->calcPage($model::find()->where(['parent_id' => $model->parent_id]));
        $returnTo = ['index', // try to return to same place - deletion may be unsuccessfull
            'parent_id' => $model->parent_id,
            'page'      => $model->page,
            'id'        => $id,
            'sort'      => $model->orderByToSort(),
        ];

        $model->delete();

        return $this->redirect($returnTo);
    }
public function actionDelete ( $ id ) { $ model = $ this -> findModel ( $ id ) ; $ model -> orderBy = $ model :: $ defaultOrderBy ; $ model -> page = $ model -> calcPage ( $ model :: find ( ) -> where ( [ 'parent_id' => $ model -> parent_id ] ) ) ; $ returnTo = [ 'index' , // try to return to same place - deletion may be unsuccessfull 'parent_id' => $ model -> parent_id , 'page' => $ model -> page , 'id' => $ id , 'sort' => $ model -> orderByToSort ( ) , ] ; $ model -> delete ( ) ; return $ this -> redirect ( $ returnTo ) ; }
Deletes an existing Content model.
If deletion is successful, the browser will be redirected to the 'index' page.
@param integer $id
@return mixed
Deletes an existing Content model . If deletion is successful the browser will be redirected to the index page .