mercredi 7 novembre 2018

How to Customize LengthAwarePaginator

I'm using Laravel 5.7 and being kinda stuck with Pagination process. When I used the default method paginate() and called links() for the view file, I noticed that Laravel by default sets the Previous Page URL to null, currentPage() method returning 1 always(which obvoiusly should not be the case all the time) and thus the Next Page URL returning the value of the 2nd link all the time, regardless of any situation/condition. Why is it done like that? What's the point in using these methods if I had to customize? My question is however, how can the LengthAwarePagintor class be customized in a way so that,

1. I can get the CurrentPage value set to the value of the ClickEvent of the concerned pagination link

2.set the previousPageUrl() method the actual functionality which is, to get the URL of the previous link, and if no link available, redirect to the 1st link?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire