/**
  * Finds the Users model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Users the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Users::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * Deletes an existing Orders model.
  * If deletion is successful, the browser will be redirected to the 'index' page.
  * @param integer $id
  * @return mixed
  * @throws ForbiddenHttpException
  * @throws NotFoundHttpException
  * @throws \Exception
  */
 public function actionDelete($id)
 {
     $user = null;
     if (!empty(Yii::$app->user)) {
         $user = Users::findOne(Yii::$app->user->identity->getId());
     }
     if ($user['user_role_id'] !== 1) {
         throw new ForbiddenHttpException();
     }
     $this->findModel($id)->delete();
     return $this->redirect(['index']);
 }