Laravel 5.2 paginating
remove all() function, your code should be:
$content = content::paginate(10);
As suggested by Gouda Elalfy you should remove the call to all()
.
Explanation
The method paginate()
is available on Eloquent\Builder
which is what you implicitly have when you call content::paginage(10)
.
However content::all()
returns a Collection
or an array of Model
, not a Builder
.
Here it explains how to do it https://laravel.com/docs/5.2/paginationand based on that you should do:
1) In your controller change the line $content = content::all()->paginate(10);
to be
$content = content::paginate(10);
2) In your view you could use this
{{ $content->appends(Request::except('page'))->links() }}
This will do what you want!!