Returns a recent entry, latest entry is not considered recent
if the creation day is the same as today.
@return self
195246
public static function getRecent($user)
    {
        $records = static::where('user_id', $user->id)
            ->orderBy('created_at', 'desc')
            ->limit(2)
            ->get()
        ;

        if (!count($records)) {
            return null;
        }

        $first = $records->first();

        return !$first->created_at->isToday() ? $first : $records->pop();
    }
683375
public function last()
    {
        if ($this->isEmpty()) {
            return $this->makeItem(null);
        }

        $arResultIDList = $this->arElementIDList;

        $iElementID = array_pop($arResultIDList);

        return $this->makeItem($iElementID);
    }
935093
public function getDate()
    {
        if (false === $this->frontMatter->has('date')) {
            # Defaults to last modified
            return (new DateTime)->setTimestamp($this->file->getMTime());
        }

        $date = $this->frontMatter->getDate();

        if ($date instanceof DateTime) {
            return $date;
        }

        return (new DateTime)->setTimestamp($date);
    }
768037
public function insert()
    {
        Observer::dispatch(Observer::EVENT_ITEM_INSERT_BEFORE, array(
            'item' => $this
        ));

        $this->{static::DATEADDFIELD} = DateData::now();
        $insert = new Insert($this->_dbContainer);
        $insert->addFields($this->_fields);
        $insert->commit();
        $this->setId($insert->getId());
        $this->_origFields = $this->_fields;

        Observer::dispatch(Observer::EVENT_ITEM_INSERT_AFTER, array(
            'item' => $this
        ));

        return $this;
    }
51250
public function refresh() : self {
      $newCode = $this->collection->assemble();
      $tokens = Helper::getTokensFromString($newCode);

      $this->collection->setItems($tokens);
      return $this;
    }
338629
public function getPersistence()
    {
        if (null === $this->persistence) {
            $this->persistence = (isset($this->options['persistence']) && $this->options['persistence'] == true);
        }
        
        return $this->persistence;
    }
561224
public function newer()
	{
		return $this->live()
			->where('published_date', '>=', $this->published_date)
			->where('id', '<>', $this->id)
			->orderBy('published_date', 'asc')
			->orderBy('id', 'asc')
			->first();
	}
52761
public function lastInsertedId()
    {
        $query = "MATCH (n) RETURN MAX(id(n)) AS lastIdCreated";

        $statement = $this->getCypherQuery($query, []);
        $result = $statement->getResultSet();

        return $result[0][0];
    }
1049631
public static function thisWeek()
    {
        $start = CarbonDate::today();
        $end = CarbonDate::tomorrow();
        if ($start->dayOfWeek !== CarbonDate::MONDAY) {
            $start->modify('last monday');
        }

        return new static($start, $end);
    }
1010401
public function currentNews()
    {
        if ($this->currentNews) {
            return $this->currentNews;
        }

        // The the current news
        $news = $this->newsManager()->entry();

        // Format the news if there's any
        if ($news) {
            $this->currentNews = $this->newsFormatFull($news);
        }

        return $this->currentNews;
    }
102781
public function refreshLastPost()
    {
        /** @var Post $lastPost */
        if ($lastPost = $this->comments()->latest()->first()) {
            $this->setLastPost($lastPost);
        }

        return $this;
    }
681658
def created(self):
        ''
        return dateutil.parser.parse(str(self.f.latestRevision.created))
497604
protected function createEntry()
    {
        $entry = new Entry();
        $entry->setVisible(false)
              ->setName($this->name);
        $this->setEntry($entry);
        return $entry;
    }
529108
public function getLastMessage()
    {
        if (($message = $this->getMessages()->orderBy(['created_at' => SORT_DESC])->limit(1)->one()) != null) {
            return $message;
        }
        return $this;
    }
636231
public function getIsUnPublishScheduled()
    {
        if (!$this->owner->UnPublishOnDate) {
            return false;
        }
        $now = DBDatetime::now()->getTimestamp();
        $unpublish = $this->owner->dbObject('UnPublishOnDate')->getTimestamp();

        return $now < $unpublish;
    }
729091
public function getLastModified()
	{
		if ($this->lastModified == null) {
			$this->requestHead();
		}
		return $this->lastModified == null ? new \DateTime() : $this->lastModified;
	}
1110007
public function lastInsert()
	{
		$query = $this->connection->createSelect();
		$query->setQuery('*:*');
		$query->setFields(array('timestamp'));
		$query->addSort('timestamp', 'DESC');
		$query->setRows(1);
		$query->setStart(0);

		$results = $this->connection->execute($query);
		foreach ($results as $document)
		{
			foreach ($document as $field => $value)
			{
				$result = $value;
				return $result;
			}
		}
	}