/** * Paginate the given query into a simple paginator. * * @param int $perPage * @param array $columns * @param string $pageName * @param int|null $page * * @return \Illuminate\Contracts\Pagination\Paginator */ public function simplePaginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) { $this->applyCriteria(); if ($this->isSearching()) { /** @var \Illuminate\Pagination\Paginator $paginator */ $paginator = $this->scout->paginate($perPage, $pageName, $perPage); /** @var \Illuminate\Database\Eloquent\Collection $collection */ $collection = $paginator->getCollection(); $collection->load($this->with); return $paginator; } return $this->getQuery()->simplePaginate($perPage, $columns, $pageName, $page); }
/** * Get the first entry. * * @return Presenter */ public function first() { return (new Decorator())->decorate($this->query->first()); }