FindLast

@return \Blade\Migrations\Migration|null
485050
public function findLast()
    {
        $sql = sprintf("SELECT id, name, created_at FROM {$this->tableName} ORDER BY id DESC LIMIT 1");
        if ($row = $this->adapter->selectRow($sql)) {
            return $this->_makeModel($row);
        }

        return null;
    }
751193
public function getLastValue($key)
    {
        $nb = count($this->table);
        if ($nb>0) {
            return $this->table[$nb-1][$key];
        } else {
            return null;
        }
    }
742730
public function last($key = '') {
        $crumbs = $this->get($key);

        if (!$crumbs) {
            return null;
        }

        $last = array_slice($crumbs, -1);

        return $last[0];
    }
247539
public function tail()
    {
        $last = count($this->parts) - 1;
        if ($last < 0) {
            return null;
        }

        return $this->parts[$last];
    }
749063
public function getLast()
    {
        try {
            $query = (new SelectQueryBuilder())->select([
                'max_value' => QueryExpression::max('id')
            ])->from(static::tableName());
            $sql = $query->parse($this->connection->getDialect())->getSQL();
            $data = $this->connection->prepare($sql)->execute()->fetch();
            return $data['max_value'];
        } catch (\PDOException $e) {
            return -1;
        }
    }
775367
public function getLastLevel()
    {
        if ($this->lastLevel === null) {
            $this->lastLevel = $this->fusionValue('lastLevel');
            if ($this->lastLevel > self::MAXIMUM_LEVELS_LIMIT) {
                $this->lastLevel = self::MAXIMUM_LEVELS_LIMIT;
            }
        }

        return $this->lastLevel;
    }
542820
public function getLastInsertId()
    {
        $connection = $this->getConnection();
        $id = $connection->lastInsertId();
        if ($id < 1) {
            $fullTableName = $this->tableName;
            $fullUniqueIdName = $connection->quoteIdentifier($this->getUniqueId());
            $sql = /** @lang PostgreSQL */
                "SELECT $fullUniqueIdName 
                 FROM $fullTableName
                 LIMIT 1 
                 OFFSET (SELECT count($fullUniqueIdName)-1 FROM $fullTableName )";

            $id = $connection->fetchColumn($sql);
        }
        return $id;
    }
985425
public function last()
    {
        if (!$this->isCollection()) {
            return $this;
        }

        return isset($this->data[0]) ? $this->box(ArrayUtility::last($this->data)) : null;
    }
488643
public function getLastPoint()
    {
        if (empty($this->points)) {
            return null;
        }
        return $this->points[count($this->points) - 1];
    }
510942
public function getLastSavedDraftRevision()
    {
        if (!empty($this->lastSavedDraft)) {
            return $this->lastSavedDraft;
        }

        $published = $this->publishedRevision;
        $staged = $this->stagedRevision;

        $arrayCollection = $this->revisions->toArray();

        /** @var \Rcm\Entity\Revision $revision */
        $revision = end($arrayCollection);

        if (empty($revision)) {
            return null;
        }

        $found = false;

        while (!$found) {
            if (empty($revision)) {
                break;
            } elseif (!empty($published)
                && $published->getRevisionId() == $revision->getRevisionId()
            ) {
                $found = false;
            } elseif (!empty($staged)
                && $staged->getRevisionId() == $revision->getRevisionId()
            ) {
                $found = false;
            } elseif ($revision->wasPublished()) {
                $found = false;
            } else {
                $found = true;
            }

            if (!$found) {
                $revision = prev($arrayCollection);
            }
        }

        return $this->lastSavedDraft = $revision;
    }
222091
public function last()
    {
        return (null === $this->getDraft()) ? $this->getData($this->count() - 1) : $this->getDraft()->last();
    }
674282
public function findDescendantsWithTrashed()
    {
        return static::withTrashed()->where($this->getTreeColumn('path'), 'LIKE', $this->{$this->getTreeColumn('path')} . '%')
            ->orderBy($this->getTreeColumn('level'), 'ASC');
    }
260411
public function last($return = false)
    {
        if (!empty($this->query)) {
            if ($return) {
                return $this->query;
            }
            var_dump($this->query);
            return null;
        }
        return false;
    }
269087
public function last()
    {
        $lastIndex = (count($this->source) - 1);
        if (isset($this->source[$lastIndex])) {
            return $this->source[$lastIndex];
        }

        return null;
    }
807778
public function getLast()
    {
        $last = null;

        if (count($this->objects) > 0) {
            $last = end($this->objects);
        }

        return $last;
    }
273750
public function getLast($migrations)
    {
        $query = $this->table()
            ->where('batch', $this->getLastBatchNumber($migrations))
            ->whereIn('migration', $migrations)
            ;

        $result = $query->orderBy('migration', 'desc')->get();

        return collect($result)->map(function ($item) {
            return (array) $item;
        })->lists('migration');
    }
343277
public function getLastTag()
    {
        $finder = Finder::create()
            ->files()
            ->in(sprintf('%s/.git/refs/tags', $this->path))
            ->sortByChangedTime();

        if ($finder->count() == 0) {
            return null;
        }

        $files = iterator_to_array($finder->getIterator(), false);
        $files = array_reverse($files);
        /** @var $firstFile SplFileInfo */
        $firstFile = $files[0];
        $tagName = $firstFile->getFilename();

        return Tag::pick($this, $tagName);
    }