ahmednawazkhan's avatar

Laravel 5/ 5.4 paginator is not working in production environment

In my local environment i did ""$items = Model::paginate(10);"" and it worked. Then i pushed it to production and when i click on the pagination links it displays page 1 again and again. then i did ""dd($items)."" i found that the current Page property of ""length aware pagination"" is not changing when i change the address to ""/items?page=*."" How to make current page property change accordingly or there is some thing else? thanks in advance

0 likes
2 replies
ahmednawazkhan's avatar
ahmednawazkhan
OP
Best Answer
Level 4

I am using ubuntu 16.04 nginx server. The problem was that $_GET session variables were not being set properly. so what I did was inside /etc/nginx/sites-available/default and inside

location / 

block/ directive I changed try_files $uri $uri/ /index.php?$query_string; to try_files $uri $uri/ /index.php?$args;and it worked. Or see

https://stackoverflow.com/questions/27849149/laravel-5-nginx-server-config-issue-with-url-query-strings

or

https://stackoverflow.com/questions/44602067/laravel-5-5-4-paginator-is-not-working-in-nginx-production-environement

2 likes

Please or to participate in this conversation.