user3708740
user3708740

Reputation: 1

laravel 5.2 pagination error Method links does not exist

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?

Upvotes: 0

Views: 3197

Answers (1)

H.Kontodios
H.Kontodios

Reputation: 346

Could you please try this:
return \View::make('home')->with('users',$users);

Upvotes: 0

Related Questions