oroalej's avatar

Pagination without ...

I would like to create a pagination only 1 2 3 4 5 6 7 8. However, when the page is more than 10, the pagination becomes 1 2 3 4 5 6 7 8 ... 9 10. How can i remove the ... 9 10? Is there a way to do this?

0 likes
1 reply
Snapey's avatar
Snapey
Best Answer
Level 122

If you don't use the ->links() function, and construct your own.

There are functions in the paginator to return the URLs for each page. You just need to decide how to iterate over them

https://laravel.com/docs/5.5/pagination#paginator-instance-methods

You say you don't want 1 2 3 4 5 6 7 8 ...9 10 What do you want? If there are 15 pages and you are on page 4? or what if you are on page 12? Do you want to show a fixed number either side of the current page?

1 like

Please or to participate in this conversation.