/** * Last used reward points. * * @return mixed */ public function getLastUsedDate() { //last used from the reward history based on the points delta used //enterprise module //@codingStandardsIgnoreStart $lastUsed = $this->historyFactory->create()->addCustomerFilter($this->customer->getId())->addWebsiteFilter($this->customer->getWebsiteId())->addFieldToFilter('points_delta', ['lt' => 0])->setDefaultOrder()->setPageSize(1)->getFirstItem()->getCreatedAt(); //@codingStandardsIgnoreEnd //for any valid date if ($lastUsed) { return $this->helper->formatDate($lastUsed, 'short', true); } return ''; }