Laravel 4 Call to undefined method Illuminate\Database\Eloquent\Collection::links()
crud, laravel, laravel-4
Solution
You are using pagination, so `User::all()` won't work because you are asking Eloquent to return all records without pagination. See Pagination Usage.
You need to change
$users = User::all();
to
$users = User::paginate(10);
Obviously you can change 10 to the number of records per page you want.
Problem
I tried to implement codes in the book entitled "Learning Laravel 4 Application Development". A simple use CRUD app as following, Controller ``` $users = User::all(); return View::make('users.index', compact('users')); ``` View ``` <!--an simple table ...--> <div class="pagination"> {{ $users->links() }} </div> ``` And it shows an error: `Call to undefined method Illuminate\Database\Eloquent\Collection::links()` Could someone give me an hint?.