mardi 31 juillet 2018

How to make pagination in Laravel 5.2 when the URL length exceeds its limit

I am working on a project with Laravel 5.2 I have hidden ID values and I want to search the ID from the database and later I will sort it in descending order. I wrote this code.

Controller

$jsonObject =json_decode(request('membersdata'));
$member = (new Membermasternewdata)->newQuery();
$members=$member->whereIn('id', $jsonObject)->latest();
$members=$members->paginate(50);

View The html page



My URL example http://localhost:8000/ascendingregistrationdate?_token=ktlNHgx9PLNCOQL0CE1YZT2AzmWpJeXexqOduy8F&membersdata=%5B199%2C284%2C344%2C355%2C381%2C461%2C488%2C576%2C601%2C652%2C747%2C825%2C849%2C878%2C883%2C912%2C913%2C915%2C972%2C1004%2C1071%2C1310%2C1501%2C1534%2C1585%2C1610%2C1677%2C1854%2C1923%2C1935%2C2163%2C2301%2C2302%2C2326%2C2339%2C2717%2C2773%2C3052%2C3361%2C3446%2C3683%2C3848%2C3853%2C3914%2C4114%2C4244%2C4311%2C4357%2C4389%2C4881%2C5312%2C5322%5D&page=2

I got a problem with pagination. For around 400 records, the pagination works. But If I have many records, pagination doesn't work as the URL length exceed its limit.  Is there any workaround for this problem?

Thank you!



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2v43R5z
via IFTTT

Aucun commentaire:

Enregistrer un commentaire