Wednesday, March 29, 2017

Laravel Paginator object does not have render method

I do the following:

$array = new LengthAwarePaginator(array_slice($array, $offset, $perPage, true), count($array),$perPage, $page, ['path' => $request->url(), 'query' => $request->query()]);
dd($array->render());

and i get the proper html output of the render method.

Then I try:

$array =  new Paginator(array_slice($array, $offset, $perPage, true), $perPage, $page, ['path' => $request->url(), 'query' => $request->query()]);
dd($array->render());

and the output is "".

When I (dd($array)); I get :

Paginator {#310 ▼
  #hasMore: false
  #items: Collection {#315 ▶}
  #perPage: 10
  #currentPage: 1
  #path: "https://localhost/search/3"
  #query: array:1 [▶]
  #fragment: null
  #pageName: "page"
}

Anyone know why my Paginator doesn't have a render method?



via user3494047

Advertisement