Paginate results

@param int $perPage
@param array $columns
@param string $pageName
@param null $page
@return \Illuminate\Contracts\Pagination\LengthAwarePaginator
773323
public function paginate($perPage = 10, array $columns = ['*'], $pageName = 'page', $page = null)
    {
        $this->applyCriteria();

        return $this->model->paginate($perPage, $columns, $pageName, $page);
    }
1264090
public function paginate($limit = null, $columns = ['*'], $pageName = 'page', $page = null)
    {
        return $this->simpleWrap(Action::READ, [$this, '_paginate']);
    }
285632
public function setPagination($page, $perPage)
    {
        $this->setParam('page', $page);
        $this->setParam('per_page', $perPage);

        return $this;
    }
1189556
public function forPageBeforeId($perPage = 15, $lastId = 0, $column = 'id')
    {
        $this->orders = $this->removeExistingOrdersFor($column);

        if (! is_null($lastId)) {
            $this->where($column, '<', $lastId);
        }

        return $this->orderBy($column, 'desc')
                    ->take($perPage);
    }
471921
public function paginate($perPage = null, $columns = array('*'), $pageName = 'page', $page = null)
    {
        if (is_null($page)) {
            $page = Paginator::resolveCurrentPage($pageName);
        }

        $path = Paginator::resolveCurrentPath($pageName);

        if (is_null($perPage)) {
            $perPage = $this->model->getPerPage();
        }

        $total = $this->query->getPaginationCount();

        if ($total > 0) {
            $results = $this->forPage($page, $perPage)->get($columns);
        } else {
            $results = $this->model->newCollection();
        }

        return new Paginator($results, $total, $perPage, $page, compact('path', 'pageName'));
    }
1338667
public function paginate($perPage = 15, $columns = ['*'], $sort = '', $order = 'asc')
    {
        $m = $this->model;

        if ($sort) {
            $m->orderBy($sort, $order);
        } else {
            if ($this->defaultOrderColumn) {
                $m->orderBy($this->defaultOrderColumn, $order);
            }
        }
        return $m->paginate($perPage, $columns);
    }
1030790
public function simplePagination($perPage = 15){
        $pegination = $this->pagination($perPage);

        $pegination->setMode(Paginator::MODE_SIMPLE);
        return $pegination;
    }
126129
public function paginate(Builder $builder, $perPage, $page)
    {
        $results = $this->performSearch($builder);

        if ($builder->limit) {
            $results['hits'] = $builder->limit;
        }

        $filtered = $this->discardIdsFromResultSetByConstraints($builder, $results['ids']);

        $results['hits'] = $filtered->count();

        $chunks = array_chunk($filtered->toArray(), $perPage);

        if (empty($chunks)) {
            return $results;
        }

        if (array_key_exists($page - 1, $chunks)) {
            $results['ids'] = $chunks[$page - 1];
        } else {
            $results['ids'] = end($chunks);
        }

        return $results;
    }
1103816
public function paginate($perPage = 25, $currentPage = null, array $options = [])
    {
        $currentPage = $this->getPageFromInput($currentPage, $options);
        $offset      = ($currentPage - 1) * $perPage;
        $total       = $this->count();
        $entries     = $this->get()->slice($offset, $perPage)->all();

        return new LengthAwarePaginator($entries, $total, $perPage, $currentPage, $options);
    }
991656
public function paginateAll($perPage = 15, $pageName = 'page')
    {
        $query = $this->createQueryBuilder('o')->getQuery();

        return $this->paginate($query, $perPage, $pageName, false);
    }
386107
public function simplePaginate($perPage = null, $columns = array('*'), $pageName = 'page', $page = null)
    {
        if (is_null($page)) {
            $page = Paginator::resolveCurrentPage($pageName);
        }

        $path = Paginator::resolveCurrentPath($pageName);

        if (is_null($perPage)) {
            $perPage = $this->model->getPerPage();
        }

        $offset = ($page - 1) * $perPage;

        $results = $this->skip($offset)->take($perPage + 1)->get($columns);

        return new SimplePaginator($results, $perPage, $page, compact('path', 'pageName'));
    }
753286
public function forPage($page, $perPage)
    {
        $offset = max(0, ($page - 1) * $perPage);

        return $this->slice($offset, $perPage);
    }
315318
public function paginate($limit = null, $columns = ['*'], $method = "paginate")
    {
        $this->applyCriteria();
        $this->applyScope();
        $limit = is_null($limit) ? config('repository.pagination.limit', 15) : $limit;
        $results = $this->model->{$method}($limit, $columns);
        $results->appends(app('request')->query());
        $this->resetModel();

        return $this->parserResult($results);
    }
1025533
public function paginate($perPage = 15, $columns = ['*'], $pageName = 'page', $page = null)
    {
        $result = $this->getBuilder()->paginate($perPage, $columns, $pageName, $page);

        // Reset query builder
        $this->resetBuilder();

        return $result;
    }
491436
public function LengthAwarePaginator($items, $resultsPerPage = 4)
    {
        //Get current page form url e.g. &page=6
        $currentPage = LengthAwarePaginator::resolveCurrentPage();

        //Create a new Laravel collection from data
        $collection = new Collection($items);

        //Slice the collection to get the items to display in current page
        $currentPageSearchResults = $collection->slice(($currentPage - 1) * $resultsPerPage, $resultsPerPage) -> all();

        //Create our paginator and pass it to the view
        return new LengthAwarePaginator($currentPageSearchResults, count($collection), $resultsPerPage);
    }
147076
public function paginate($perPage = null, $columns = array('*'))
	{
		$this->query->addSelect($this->getSelectColumns($columns));

		// When paginating results, we need to add the pivot columns to the query and
		// then hydrate into the pivot objects once the results have been gathered
		// from the database since this isn't performed by the FlyORM builder.
		$pager = $this->query->paginate($perPage, $columns);

		$this->hydratePivotRelation($pager->getItems());

		return $pager;
	}
616799
public function paginate($perPage = 30)
    {
        $page      = request()->input('page', 1);
        $items     = $this->slice(($page * $perPage) - $perPage, $perPage, true);
        $paginator = new LengthAwarePaginator($items, $this->count(), $perPage, $page);

        $paginator->setPath(request()->url());

        return $paginator;
    }