Level 70
You have missed one thing. It should be like this-
public function index(){
$posts = Post::paginate(10);
return view('index')->with('posts', $post);
}
Now you are able to use links().
{{ $posts->links() }}
6 likes
I am trying to paginate records, but it shows me error.
public function index(){
$posts = Post::get();
return view('index')->with('posts', $post);
}
If I use following link, it will show error.
{{ $posts->links() }}
You have missed one thing. It should be like this-
public function index(){
$posts = Post::paginate(10);
return view('index')->with('posts', $post);
}
Now you are able to use links().
{{ $posts->links() }}
Please or to participate in this conversation.