protected function paginator(Paginator $paginator, Request $request)
    {
        foreach ($request->query as $key => $value) {
            if ($key != 'page') {
                $paginator->appends($key, $value);
            }
        }

        $pagination = [
            'pagination' => [
                'total'        => (int) $paginator->total(),
                'count'        => count($paginator->items()),
                'per_page'     => (int) $paginator->perPage(),
                'current_page' => (int) $paginator->currentPage(),
                'total_pages'  => (int) $paginator->lastPage(),
                'links'        => [
                    'next_page'     => $paginator->nextPageUrl(),
                    'previous_page' => $paginator->previousPageUrl(),
                ],
            ],
        ];

        $items = $paginator->getCollection();

        return $this->setMetaData($pagination)->setData(AutoPresenter::decorate($items->values()))->respond();
    }
protected function paginator(Paginator $paginator, Request $request)
    {
        foreach ($request->query as $key => $value) {
            if ($key != 'page') {
                $paginator->appends($key, $value);
            }
        }

        $pagination = [
            'pagination' => [
                'total'        => (int) $paginator->total(),
                'count'        => count($paginator->items()),
                'per_page'     => (int) $paginator->perPage(),
                'current_page' => (int) $paginator->currentPage(),
                'total_pages'  => (int) $paginator->lastPage(),
                'links'        => [
                    'next_page'     => $paginator->nextPageUrl(),
                    'previous_page' => $paginator->previousPageUrl(),
                ],
            ],
        ];

        $items = $paginator->getCollection();

        return $this->setMetaData($pagination)->setData(AutoPresenter::decorate($items->values()))->respond();
    }
protected function paginator ( Paginator $ paginator , Request $ request ) { foreach ( $ request -> query as $ key => $ value ) { if ( $ key != 'page' ) { $ paginator -> appends ( $ key , $ value ) ; } } $ pagination = [ 'pagination' => [ 'total' => ( int ) $ paginator -> total ( ) , 'count' => count ( $ paginator -> items ( ) ) , 'per_page' => ( int ) $ paginator -> perPage ( ) , 'current_page' => ( int ) $ paginator -> currentPage ( ) , 'total_pages' => ( int ) $ paginator -> lastPage ( ) , 'links' => [ 'next_page' => $ paginator -> nextPageUrl ( ) , 'previous_page' => $ paginator -> previousPageUrl ( ) , ] , ] , ] ; $ items = $ paginator -> getCollection ( ) ; return $ this -> setMetaData ( $ pagination ) -> setData ( AutoPresenter :: decorate ( $ items -> values ( ) ) ) -> respond ( ) ; }
Respond with a pagination response.

@param \Illuminate\Pagination\Paginator $paginator
@param \Illuminate\Http\Request         $request

@return \Illuminate\Http\JsonResponse
Respond with a pagination response .