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 ?
Pagination Laravel 5.6.26, for the pagination the controller are :
Controller code (https://laravel.com/docs/5.6/pagination#basic-usage)
Front end into blade (view) (https://laravel.com/docs/5.6/pagination#displaying-pagination-results)
In other frameworks, pagination can be very painful. Laravel 5 makes it a breeze. For using it, first you have to make a change in your controller code where you calling data from the database:
...after that you can use this code:
That will make you use simple Laravel 5 beauty.
Hi there is my code for pagination: Use in view:
@include('pagination.default', ['paginator' => $users])
Views/pagination/default.blade.php
In Laravel 5 there is no method "links" you can try this