/**
  * Deletes an existing User model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  *
  * @param  integer $id The user id.
  * @return \yii\web\Response
  *
  * @throws NotFoundHttpException
  */
 public function actionDelete($id)
 {
     $this->findModel($id)->delete();
     // delete this user's role from auth_assignment table
     if ($role = Role::find()->where(['user_id' => $id])->one()) {
         $role->delete();
     }
     Yii::$app->session->setFlash('success', 'Deleted successfully');
     return $this->redirect(['index']);
 }
 /**
  * Deletes an existing User model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  *
  * @param  integer $id The user id.
  * @return \yii\web\Response
  *
  * @throws NotFoundHttpException
  */
 public function actionDelete($id)
 {
     $this->findModel($id)->delete();
     // delete this user's role from auth_assignment table
     if ($role = Role::find()->where(['user_id' => $id])->one()) {
         $role->delete();
     }
     return $this->redirect(['index']);
 }