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
Laravel's paginator is integrated with the query builder and Eloquent ORM and provides convenient, easy-to-use pagination of database records with zero configuration. By default, the HTML generated by the paginator is compatible with the Tailwind CSS framework; however, Bootstrap pagination support is also available.
The Laravel paginator classes implement the Illuminate\Contracts\Support\Jsonable Interface contract and expose the toJson method, so it's very easy to convert your pagination results to JSON. You may also convert a paginator instance to JSON by returning it from a route or controller action:
If you are using Laravel's default Tailwind pagination views and the Tailwind JIT engine, you should ensure your application's tailwind.config.js file's content key references Laravel's pagination views so that their Tailwind classes are not purged: There are several ways to paginate items.
By default, the HTML generated by the paginator is compatible with the Tailwind CSS framework; however, Bootstrap pagination support is also available.
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 Laravel 5 - NGINX Server Config Issue with URL Query Strings
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With