I am trying to paginate my results from a database using a Laravel 5.2.31 app, but the pagination isn't working.
When I use {!! $users->links() !!}
in my view, I get an error 'Method links does not exist' .
The same thing happens when I use {!! $users->render() !!}
My Controller:
public function index() {
$users= User::orderBy('created_at', 'desc')->paginate(4);
return view('home', ['users' => $users]);
}
Any help?
$users
by doingdd($users);
before calling theview
. – linuxartisanlinuxartisan
said dump the object and see if thats of typeLengthAwarePaginator
– Cerlin