/** * Authenticate user by $username and $password * * @param ModelUser $user * @return $this */ public function recordLogin(ModelUser $user) { $connection = $this->getConnection(); $data = ['logdate' => (new \DateTime())->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT), 'lognum' => $user->getLognum() + 1]; $condition = ['user_id = ?' => (int) $user->getUserId()]; $connection->update($this->getMainTable(), $data, $condition); return $this; }
/** * Authenticate user by $username and $password * * @param ModelUser $user * @return $this */ public function recordLogin(ModelUser $user) { $adapter = $this->_getWriteAdapter(); $data = array('logdate' => $this->dateTime->now(), 'lognum' => $user->getLognum() + 1); $condition = array('user_id = ?' => (int) $user->getUserId()); $adapter->update($this->getMainTable(), $data, $condition); return $this; }