Пример #1
0
 public function actionIndex()
 {
     if (!Yii::$app->user->isGuest) {
         $user = User::findOne(['id' => Yii::$app->user->id]);
         return $this->render('index', ['user' => $user]);
     }
 }
Пример #2
0
 /**
  * Finds user by [[username]]
  *
  * @return User|null
  */
 public function getUser()
 {
     if ($this->_user === false) {
         $this->_user = User::findByUsername($this->username);
     }
     return $this->_user;
 }
Пример #3
0
 /**
  * Simply saves the given instance
  *
  * @param  User $instance
  *
  * @return  boolean Success
  */
 public function save(User $instance)
 {
     return $instance->save();
 }
Пример #4
0
 static function findFromEmail($email)
 {
     $user = User::where('email', '=', $email)->first();
     return $user;
 }