Setup pagination.

@param  bool|int|null  $perPage

@return $this
174387
public function paginate($perPage)
    {
        if (\filter_var($perPage, FILTER_VALIDATE_INT, ['options' => ['min_range' => 1]]) && ! \is_bool($perPage)) {
            $this->perPage = $perPage;
            $this->paginate = true;
        } elseif (\filter_var($perPage, FILTER_VALIDATE_BOOLEAN)) {
            $this->perPage = null;
            $this->paginate = $perPage;
        } else {
            $this->perPage = null;
            $this->paginate = false;
        }

        return $this;
    }
923590
public function paginate($perPage = 25, $pageName = 'page')
    {
        $this->paginate = (int) $perPage;
        $this->pageName = $pageName;

        return $this;
    }
1303734
public function setPage($page)
    {
        $this->page = null === $page ? null : (int)$page;
        $this->updateOffset();
        return $this;
    }
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;
    }
775127
public function paginate($page, $perPage, $total)
    {
        // set X-Total-Count header
        $this->response->setHeader('X-Total-Count', $total);

        // compute links
        $pageCount = max(1, ceil($total / $perPage));
        $base = $this->getEndpoint();

        $requestQuery = $this->request->query();

        // remove any previously set per_page value
        if (isset($requestQuery['per_page'])) {
            unset($requestQuery['per_page']);
        }

        // set the per_page value unless it's the default
        if ($perPage != self::DEFAULT_PER_PAGE) {
            $requestQuery['per_page'] = $perPage;
        }

        // self/first links
        $links = [
            'self' => $this->link($base, array_replace($requestQuery, ['page' => $page])),
            'first' => $this->link($base, array_replace($requestQuery, ['page' => 1])),
        ];

        // previous/next links
        if ($page > 1) {
            $links['previous'] = $this->link($base, array_replace($requestQuery, ['page' => $page - 1]));
        }

        if ($page < $pageCount) {
            $links['next'] = $this->link($base, array_replace($requestQuery, ['page' => $page + 1]));
        }

        // last link
        $links['last'] = $this->link($base, array_replace($requestQuery, ['page' => $pageCount]));

        // build Link header
        $linkStr = implode(', ', array_map(function ($link, $rel) {
            return "<$link>; rel=\"$rel\"";
        }, $links, array_keys($links)));

        $this->response->setHeader('Link', $linkStr);
    }
271167
public function setPage(Page $page)
    {
        $this->_page = $page;
        $page->setMainSection($this);

        return $this;
    }
127580
public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null)
    {
        $cacheKey = $this->generateKey([$perPage, $columns, $pageName, $page]);

        return $this->cacheResults(get_called_class(), __FUNCTION__, $cacheKey, function () use ($perPage, $columns, $pageName, $page) {
            return $this->model->paginate($perPage, $columns, $pageName, $page);
        });
    }
884411
public function paginate($perPage, $columns, $pageName, $page)
    {
        return $this->db->paginate($perPage, $columns, $pageName, $page);
    }
11338
public function paginate(Builder $builder, $perPage, $page)
    {
        $result = $this->performSearch($builder, [
            'numericFilters' => $this->filters($builder),
            'from' => (($page * $perPage) - $perPage),
            'size' => $perPage,
        ]);

       $result['nbPages'] = $result['hits']['total']/$perPage;

        return $result;
    }
351238
public function setItemsPerPage(int $itemsPerPage = null)
    {
        return $this
            ->pagination
            ->setItemsPerPage(
                $this->pagination->getItemsPerPage()
            );
    }
584567
public function setPaging($page, $perPage)
    {
        $this->setParam('page', $page);
        $this->setParam('per_page', $perPage);

        return $this;
    }
1225562
public function paginate($perPage = 20)
    {
        $page = request()->get('page', 1);
        $path = request()->url();

        return new LengthAwarePaginator(
            $this->forPage($page, $perPage),
            $this->count(),
            $perPage,
            $page,
            compact('path')
        );
    }
1030790
public function simplePagination($perPage = 15){
        $pegination = $this->pagination($perPage);

        $pegination->setMode(Paginator::MODE_SIMPLE);
        return $pegination;
    }
1034126
public function paginate($per_page = 10, $page_name = "page", $page = null)
    {

        $this->take($per_page);

        $page = $page ?: Request::get($page_name, 1);

        $this->skip(($page * $per_page) - $per_page);

        $objects = $this->get();

        return new Pagination($objects, $objects->total, $per_page, $page, ['path' => Request::url(), 'query' => Request::query()]);
    }
773323
public function paginate($perPage = 10, array $columns = ['*'], $pageName = 'page', $page = null)
    {
        $this->applyCriteria();

        return $this->model->paginate($perPage, $columns, $pageName, $page);
    }
752169
public function setPagination (int $currentPage=1, int $perPage=20, int $adjacent=1, int $totalCount=0)
    {
        $this->currentPage     	= $currentPage;
        $this->perPage         	= $perPage;
        $this->adjacent 		= $adjacent;
        $this->totalCount      	= $totalCount;
    }
574437
public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null)
    {
        $this->parse();

        return $this->getHandler()->paginate($this->input('limit', $perPage), $this->getColumns($columns), $this->config('prefix', '').$pageName, $page);
    }