phplaravelpaginationlaravel-5

How to use pagination in laravel 5?


am trying to port my laravel4 application to laravel 5 . In the previous version i could use the following method for generating pagination urls .

In controller:

$this->data['pages']= Page::whereIn('area_id', $suburbs)->where('score','>','0')->orderBy('score','desc')->paginate(12);

and after sharing the data array with the view, i could user

In views :

{{$pages->links()}}

In laravel 5 the doing that results in following error

ErrorException in AbstractPaginator.php line 445:
call_user_func_array() expects parameter 1 to be a valid callback, class 'Illuminate\Support\Collection' does not have a method 'links'

not sure what i am missing here, can somebody help ?


Solution

  • In Laravel 5 there is no method "links" you can try this

    {!! $pages->render() !!}