當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Finder::findUserById方法代碼示例

本文整理匯總了PHP中dektrium\user\Finder::findUserById方法的典型用法代碼示例。如果您正苦於以下問題:PHP Finder::findUserById方法的具體用法?PHP Finder::findUserById怎麽用?PHP Finder::findUserById使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在dektrium\user\Finder的用法示例。


在下文中一共展示了Finder::findUserById方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: findModel

 /**
  * Finds the User model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  *
  * @param int $id
  *
  * @return User the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     $user = $this->finder->findUserById($id);
     if ($user === null) {
         throw new NotFoundHttpException('The requested page does not exist');
     }
     return $user;
 }
開發者ID:ketuker,項目名稱:oil-palm-cultivation-thesis,代碼行數:17,代碼來源:AdminController.php

示例2: actionConfirm

 /**
  * Confirms user's account. If confirmation was successful logs the user and shows success message. Otherwise
  * shows error message.
  *
  * @param int    $id
  * @param string $code
  *
  * @return string
  * @throws \yii\web\HttpException
  */
 public function actionConfirm($id, $code)
 {
     $user = $this->finder->findUserById($id);
     if ($user === null || $this->module->enableConfirmation == false) {
         throw new NotFoundHttpException();
     }
     $user->attemptConfirmation($code);
     return $this->render('/message', ['title' => Yii::t('user', 'Account confirmation'), 'module' => $this->module]);
 }
開發者ID:altairsoft,項目名稱:plutos,代碼行數:19,代碼來源:RegistrationController.php

示例3: actionConfirm

 /**
  * Attempts changing user's password.
  *
  * @param int    $id
  * @param string $code
  *
  * @return string
  * @throws \yii\web\HttpException
  */
 public function actionConfirm($id, $code)
 {
     $user = $this->finder->findUserById($id);
     if ($user === null || $this->module->emailChangeStrategy == Module::STRATEGY_INSECURE) {
         throw new NotFoundHttpException();
     }
     $user->attemptEmailChange($code);
     return $this->redirect(['account']);
 }
開發者ID:AsiaWebSolution,項目名稱:yii2GeneralVendor,代碼行數:18,代碼來源:SettingsController.php

示例4: actionConfirm

 /**
  * Attempts changing user's email address.
  *
  * @param int    $id
  * @param string $code
  *
  * @return string
  * @throws \yii\web\HttpException
  */
 public function actionConfirm($id, $code)
 {
     $user = $this->finder->findUserById($id);
     if ($user === null || $this->module->emailChangeStrategy == Module::STRATEGY_INSECURE) {
         throw new NotFoundHttpException();
     }
     $event = $this->getUserEvent($user);
     $this->trigger(self::EVENT_BEFORE_CONFIRM, $event);
     $user->attemptEmailChange($code);
     $this->trigger(self::EVENT_AFTER_CONFIRM, $event);
     return $this->redirect(['account']);
 }
開發者ID:88c,項目名稱:yii2-user,代碼行數:21,代碼來源:SettingsController.php

示例5: actionConfirm

 /**
  * Confirms user's account. If confirmation was successful logs the user and shows success message. Otherwise
  * shows error message.
  *
  * @param int    $id
  * @param string $code
  *
  * @return string
  * @throws \yii\web\HttpException
  */
 public function actionConfirm($id, $code)
 {
     $user = $this->finder->findUserById($id);
     $event = $this->getUserEvent($user);
     if ($user === null || $this->module->enableConfirmation == false) {
         throw new NotFoundHttpException();
     }
     $this->trigger(self::EVENT_BEFORE_CONFIRM, $event);
     $user->attemptConfirmation($code);
     $this->trigger(self::EVENT_AFTER_CONFIRM, $event);
     return $this->render('/message', ['title' => Yii::t('user', 'Account confirmation'), 'module' => $this->module]);
 }
開發者ID:kingzeus,項目名稱:yii2-user,代碼行數:22,代碼來源:RegistrationController.php


注:本文中的dektrium\user\Finder::findUserById方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。