Duplicate, delete this
How do I modify pagination link to page 1 using custom length aware paginator?
I have an index page with {{ $posts->links() }} by default that renders navigation page links in my view template. My controller looks like this:
public function index(){ return view('postcards.index', [ 'postcards' => Postcard::paginate(20) ]); } What this does is that it renders navigation links in my view template such that when I click on 1, my url changes to http://localhost/?page=1. When I click on 2 I get http://localhost/?page=2.
I want to customize my laravel application using customlengthawarepaginator so that when I click on 1 I get http://localhost without page =1. When I click on 2 in the navigation links I get http://localhost?page=2.
Links to page 1 used in the pagination and link prev and next tags should never include page=1 as a parameter. The expected approach to handling this is to implement a custom length aware paginator that will provide a custom URL if the previous link is to page 1.
Please or to participate in this conversation.