public function actionDelete($id, $returnUrl, $type = null) { // Find Model $model = RoleService::findById($id); // Delete/Render if exist if (isset($model)) { $model->type = $type; if ($model->load(Yii::$app->request->post(), 'Role')) { if (RoleService::delete($model)) { return $this->redirect($this->returnUrl); } } $permissions = PermissionService::getIdNameListByType($type); return $this->render('delete', ['model' => $model, 'permissions' => $permissions]); } // Model not found throw new NotFoundHttpException(Yii::$app->cmgCoreMessage->getMessage(CoreGlobal::ERROR_NOT_FOUND)); }
public function actionDelete($id, $roleType = null, $roleSlug = null) { // Find Model $model = UserService::findById($id); // Delete/Render if exist if (isset($model)) { $siteMember = $model->siteMember; if ($model->load(Yii::$app->request->post(), 'User')) { if (UserService::delete($model)) { $this->redirect($this->returnUrl); } } else { $roleMap = RoleService::getIdNameMapByType($roleType); return $this->render('@cmsgears/module-core/admin/views/user/delete', ['model' => $model, 'siteMember' => $siteMember, 'roleMap' => $roleMap, 'status' => User::$statusMapUpdate]); } } // Model not found throw new NotFoundHttpException(Yii::$app->cmgCoreMessage->getMessage(CoreGlobal::ERROR_NOT_FOUND)); }