You can for example customize the pagination view and then also the pagination links.
https://laravel.com/docs/10.x/pagination#paginator-instance-methods
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello,
I am calling a table with pagination using server-fetched partial.
The table is at www.example.com/mypage.
I also have a route that fetched the partial via the fetch() API on mypage-partial, which returns the table with the pagination links and inserts them inside the #table-container div:
// mypage-partial.blade.php
<table>
// display the data
</table>
{{ $data->appends(['queryStringKey' => 'queryStringVal'])->links() }}
The problem is that the new pagination links contain the API route, so when I click the numbers of the pagination, it redirects to:
at www.example.com/mypage/mypage-partial, instead of at www.example.com/mypage
How can I prevent the server-fetched partial links from having the API route?
Thanks
@vincent15000 I ended up using the withPath() method which lets you explicitly set the pagination URL:
$data->paginate()->withPath('/my/url');
and it worked!
Please or to participate in this conversation.