예제 #1
0
 /**
  * @param string $username
  * @throws \Exception
  */
 public function create($username)
 {
     if (false === ($user = $this->users->findOneByUsername($username))) {
         throw new \Exception(sprintf('User "%s" not found', $username));
     }
     $user->setLastLoginTime(date('Y-m-d H:i:s'))->save();
     $this->userSessions->create(['hash' => $this->session->getHash(), 'user_id' => $user->getId(), 'remote_address' => $this->session->getAddress(), 'start_time' => $user->getLastLoginTime()]);
 }