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