当前位置: 首页>>代码示例>>PHP>>正文


PHP User::findIdentity方法代码示例

本文整理汇总了PHP中app\models\User::findIdentity方法的典型用法代码示例。如果您正苦于以下问题:PHP User::findIdentity方法的具体用法?PHP User::findIdentity怎么用?PHP User::findIdentity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\User的用法示例。


在下文中一共展示了User::findIdentity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionIndex

 public function actionIndex($mid = '', $f = 0)
 {
     $user = User::findIdentity(Yii::$app->user->id);
     $regFrm = new RegisterForm();
     $rstFrm = new RestorePswForm();
     $spOffs = new SpecialOffer();
     $spOffs = $spOffs->getAllSpecialOffers();
     if ($f) {
         $logFrm = new LoginForm(['scenario' => LoginForm::SCENARIO_LOGIN_CAPTCHA]);
     } else {
         $logFrm = new LoginForm(['scenario' => LoginForm::SCENARIO_LOGIN]);
     }
     $city = City::find()->all();
     $address = new Address();
     $distr = $address->getDistrict();
     $category = Category::find()->all();
     $brand = Brand::find()->all();
     $msg = '';
     switch ($mid) {
         case 1:
             $msg = Common::M_EMAIL_SEND;
             break;
         case 2:
             $msg = Common::M_PSW_EMAIL_SEND;
             break;
         case 3:
             $msg = Common::M_PSW_RESTORE_SUCCESS;
             break;
     }
     return $this->render('index', ['msg' => $msg, 'user' => $user, 'spOffs' => $spOffs, 'regFrm' => $regFrm, 'logFrm' => $logFrm, 'rstFrm' => $rstFrm, 'city' => $city, 'distr' => $distr, 'category' => $category, 'brand' => $brand]);
 }
开发者ID:Bibihelper,项目名称:Project2015,代码行数:31,代码来源:IndexController.php

示例2: loadEmail

 public function loadEmail()
 {
     $user = User::findIdentity(Yii::$app->user->id);
     if ($user) {
         $this->email = $user->email;
     }
 }
开发者ID:Bibihelper,项目名称:Project2015,代码行数:7,代码来源:ChangeEmailForm.php

示例3: getDateFilterWithPayday

 /**
  * @return int
  */
 public static function getDateFilterWithPayday()
 {
     $user_id = Yii::$app->user->getId();
     $user = User::findIdentity($user_id);
     $payday = $user->payday;
     if ($payday) {
         $currentDay = (int) date("d", time());
         $currentMonth = (int) date("m", time());
         $currentYear = (int) date("Y", time());
         if ($payday <= $currentDay) {
             $date = [$currentYear, $currentMonth, $payday];
         } else {
             // адо искать с прошлого месяца
             if ($currentMonth == 1) {
                 $prevMonth = 12;
                 $date = [$currentYear, $prevMonth, $payday];
             } else {
                 $date = [$currentYear, $currentMonth - 1, $payday];
             }
         }
         while (checkdate($date[1], $date[2], $date[0]) == false) {
             if ($date[2] == 1) {
                 return null;
             }
             //WTF
             $date[2]--;
         }
         return $date;
     } else {
         return null;
     }
 }
开发者ID:RStuffGit,项目名称:money,代码行数:35,代码来源:DateComponent.php

示例4: getUser

 public function getUser()
 {
     if ($this->_user === false) {
         $this->_user = User::findIdentity($this->id);
     }
     return $this->_user;
 }
开发者ID:trieyouth,项目名称:basic,代码行数:7,代码来源:SignupForm.php

示例5: actionIndex

 public function actionIndex()
 {
     $user_id = Yii::$app->user->getId();
     $user = User::findIdentity($user_id);
     $active_purse = Purse::find()->where(['user_id' => $user_id, 'active' => 1])->one();
     $purses = Purse::find()->where(['user_id' => $user_id])->all();
     if ($user->payday) {
         // если есть дата зп
         $datePayDay = DateComponent::getDateFilterWithPayday();
     } else {
         $datePayDay = [date('Y'), date("m"), 1];
         // иначе ставим 1 число текущего месяца
     }
     $operations = Expense::find()->orderBy('datetime desc')->limit(6)->all();
     $types = TypeExpense::find()->where(['user_id' => $user_id])->select(['type_expense.*', TypeExpense::SELECT_SUM])->innerJoinWith(['expenses' => function ($query) use($datePayDay) {
         $query->where('date(datetime)>=:date_before', [':date_before' => implode('-', $datePayDay)]);
     }])->where(['purse_id' => $active_purse->id])->groupBy('type_expense.id')->all();
     $arrTypes = [];
     $sum = 0;
     foreach ($types as $type) {
         $sum += $type->sum;
         array_push($arrTypes, ['value' => $type->sum, 'color' => ColorComponent::random_color(), 'label' => $type->name]);
     }
     //        var_dump($types->prepare(Yii::$app->db->queryBuilder)->createCommand()->rawSql);die;
     return $this->render('index', ['arrTypes' => $arrTypes, 'date' => $datePayDay[2] . "." . $datePayDay[1] . "." . $datePayDay[0], 'active_purse' => $active_purse, 'purses' => $purses, 'sum' => $sum, 'operations' => $operations]);
 }
开发者ID:RStuffGit,项目名称:money,代码行数:26,代码来源:MainController.php

示例6: loadUser

 /**
  * Загружаем пользователя
  * @return UserModel
  */
 public function loadUser()
 {
     if ($this->_model == null) {
         $this->_model = UserModel::findIdentity($this->id);
     }
     return $this->_model;
 }
开发者ID:nesteant,项目名称:i,代码行数:11,代码来源:User.php

示例7: beforeValidate

 /**
  * @inheritdoc
  */
 public function beforeValidate()
 {
     if (parent::beforeValidate()) {
         if ($this->scenario == 'user-update') {
             // Верификация должностей и пользователей
             foreach ($this->position as $key => $positionId) {
                 if (!isset($this->user[$key])) {
                     continue;
                 }
                 if (!($position = Position::findOne($positionId))) {
                     continue;
                 }
                 if (is_numeric($this->user[$key])) {
                     $user = User::findIdentity($this->user[$key]);
                 } else {
                     $user = User::findByUsername(trim($this->user[$key]));
                 }
                 if (!$user) {
                     continue;
                 }
                 $this->_verifyPositions[] = ['positionId' => $position->id, 'userId' => $user->id];
             }
             if (empty($this->_verifyPositions)) {
                 $this->addError('position', 'Вы должны указать минимум одну должность');
             }
         }
         return true;
     }
     return false;
 }
开发者ID:NikDevPHP,项目名称:yii2-test-job,代码行数:33,代码来源:ProjectForm.php

示例8: actionView

 /**
  * Просмотр
  *
  * @param $id
  * @return string
  * @throws NotFoundHttpException
  */
 public function actionView($id)
 {
     $model = User::findIdentity($id);
     if (!$model) {
         throw new NotFoundHttpException();
     }
     return $this->render('view', ['model' => $model]);
 }
开发者ID:nepster-web,项目名称:yii2-test-job,代码行数:15,代码来源:UserController.php

示例9: __construct

 public function __construct($config = [])
 {
     if (Yii::$app->user->isGuest) {
         throw new Exception('Method not allowed to guest users.');
     }
     $this->_user = User::findIdentity(Yii::$app->user->id);
     parent::__construct($config);
 }
开发者ID:shahid80,项目名称:EWay,代码行数:8,代码来源:ChangePasswordForm.php

示例10: actionUser

 public function actionUser()
 {
     if (Yii::$app->user->isGuest) {
         $this->goHome();
     }
     $user = User::findIdentity(Yii::$app->getUser()->getId());
     return $this->render('user', ['username' => $user->getUsername()]);
 }
开发者ID:aartua,项目名称:yii2-authorization,代码行数:8,代码来源:SiteController.php

示例11: actionIndex

 public function actionIndex()
 {
     $user = User::findIdentity(Yii::$app->user->id);
     $regFrm = new RegisterForm();
     $logFrm = new LoginForm();
     $rstFrm = new RestorePswForm();
     return $this->render('about', ['user' => $user, 'regFrm' => $regFrm, 'logFrm' => $logFrm, 'rstFrm' => $rstFrm]);
 }
开发者ID:Bibihelper,项目名称:Project2015,代码行数:8,代码来源:AboutController.php

示例12: actionMe

 public function actionMe()
 {
     $user = User::findIdentity(Yii::$app->user->id);
     if (!$user) {
         return ['success' => 0, 'payload' => 'Some error occurred'];
     }
     return ['success' => 1, 'payload' => $user];
 }
开发者ID:aniruddhanath,项目名称:yii2-rest-api,代码行数:8,代码来源:UserController.php

示例13: actionIndex

 public function actionIndex()
 {
     $user = new User();
     if (!\Yii::$app->user->isGuest) {
         $id = Yii::$app->user->id;
         $user = User::findIdentity($id);
     }
     return $this->render('index', array('user' => $user));
 }
开发者ID:ren06,项目名称:calculator,代码行数:9,代码来源:SiteController.php

示例14: validateOldPassword

 public function validateOldPassword($attribute, $params)
 {
     if (!$this->hasErrors()) {
         $user = User::findIdentity(Yii::$app->user->id);
         if ($user && !$user->validatePassword($this->old_password)) {
             $this->addError($attribute, Common::M_WRONG_PASSWORD);
         }
     }
 }
开发者ID:Bibihelper,项目名称:Project2015,代码行数:9,代码来源:ChangePasswordForm.php

示例15: actionShow

 /**
  * Ajax Call
  * Zeigt die Details des Benutzer an
  * 
  * @param type $id
  * 
  * @author KAS <kassel@weitkamper.de> 17.06.2015
  */
 public function actionShow($id)
 {
     #Yii::$app->view->params['headline'] = 'Benutzer Verwalten';
     // Daten des Users
     $model = User::findIdentity($id);
     // Ansicht rendern im JSON Format
     \Yii::$app->response->format = Response::FORMAT_JSON;
     return $this->renderAjax('show', ['model' => $model]);
 }
开发者ID:KasselR,项目名称:yii2-kr,代码行数:17,代码来源:UsersController.php


注:本文中的app\models\User::findIdentity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。