Using Laravel’s pagination. It is working but when it gets to the last page it shows both the previous and next button. Is there a way to hid the “next” button?
public function index() {
$posts = Post::orderBy('created_at', 'desc')->paginate(10);
return view('posts.index', compact('posts'));
}
@foreach ($posts as $post)
{{$post->title}}
@endforeach
{!! $posts->links() !!}
{{ $posts->onEachSide(2)->links() }}