Exemplo n.º 1
0
 /**
  * Find User model by ID
  *
  * @param integer|array $id User ID
  *
  * @return \cubiclab\users\models\User User
  * @throws NotFoundHttpException User not found
  */
 private function findUser($id)
 {
     if (is_array($id)) {
         /** @var User $user */
         $model = User::findIdentities($id);
     } else {
         /** @var User $user */
         $model = User::findIdentity($id);
     }
     if ($model !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('User not found');
     }
 }