/**
  * 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 (Yii::$app->user->identity->type == 'admin') {
         $model = Users::findOne($id);
     } else {
         if (Yii::$app->user->identity->type == 'partner') {
             $model = Users::find()->where('id = :id AND id = :partner_id AND type != :type', [':id' => $id, ':partner_id' => $id, ':type' => 'admin'])->one();
         } else {
             if (Yii::$app->user->identity->type == 'client') {
                 $model = Users::findOne(['id' => Yii::$app->user->identity->id, 'status' => 10]);
             }
         }
     }
     if ($model !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * 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.');
     }
 }