src/controllers/AdminPermissionController.php
public function actionDelete()
    {
        $rr = new RequestResponse();
        if ($rr->isRequestAjaxPost()) {
            try {
                $model = $this->model;
                $id = $model->name;
                $model = $this->findModel($id);
                if (!in_array($model->item->name, CmsManager::protectedPermissions())) {
                    if (\Yii::$app->getAuthManager()->remove($model->item)) {
                        $rr->message = \Yii::t('app', 'Record deleted successfully');
                        $rr->success = true;
                    } else {
                        $rr->message = \Yii::t('app', 'Record deleted unsuccessfully');
                        $rr->success = false;
                    }
                } else {
                    $rr->message = \Yii::t('app', 'This entry can not be deleted!');
                    $rr->success = false;
                }
            } catch (\Exception $e) {
                $rr->message = $e->getMessage();
                $rr->success = false;
            }
            return (array)$rr;
        }
    }
public function actionDelete()
    {
        $rr = new RequestResponse();
        if ($rr->isRequestAjaxPost()) {
            try {
                $model = $this->model;
                $id = $model->name;
                $model = $this->findModel($id);
                if (!in_array($model->item->name, CmsManager::protectedPermissions())) {
                    if (\Yii::$app->getAuthManager()->remove($model->item)) {
                        $rr->message = \Yii::t('app', 'Record deleted successfully');
                        $rr->success = true;
                    } else {
                        $rr->message = \Yii::t('app', 'Record deleted unsuccessfully');
                        $rr->success = false;
                    }
                } else {
                    $rr->message = \Yii::t('app', 'This entry can not be deleted!');
                    $rr->success = false;
                }
            } catch (\Exception $e) {
                $rr->message = $e->getMessage();
                $rr->success = false;
            }
            return (array)$rr;
        }
    }
public function actionDelete ( ) { $ rr = new RequestResponse ( ) ; if ( $ rr -> isRequestAjaxPost ( ) ) { try { $ model = $ this -> model ; $ id = $ model -> name ; $ model = $ this -> findModel ( $ id ) ; if ( ! in_array ( $ model -> item -> name , CmsManager :: protectedPermissions ( ) ) ) { if ( \ Yii :: $ app -> getAuthManager ( ) -> remove ( $ model -> item ) ) { $ rr -> message = \ Yii :: t ( 'app' , 'Record deleted successfully' ) ; $ rr -> success = true ; } else { $ rr -> message = \ Yii :: t ( 'app' , 'Record deleted unsuccessfully' ) ; $ rr -> success = false ; } } else { $ rr -> message = \ Yii :: t ( 'app' , 'This entry can not be deleted!' ) ; $ rr -> success = false ; } } catch ( \ Exception $ e ) { $ rr -> message = $ e -> getMessage ( ) ; $ rr -> success = false ; } return ( array ) $ rr ; } }
Deletes an existing Game model.
If deletion is successful, the browser will be redirected to the 'index' page.
@return mixed
Deletes an existing Game model . If deletion is successful the browser will be redirected to the index page .