How To Get First Page Last Page Total Page In Laravel Pagination

Hello Artisan,

In this example i will show you that how we can get first page from laravel pagination. I also show you that how to show get last page, total page from laravel pagination. If you don't know how to do that then this example is for you.

Sometimes we need to show first page, sometimes need last page, total page etc. In this tutorial you will know how we can show that. I will share souce code with you so that you can create it and use it.

First Page:

$users = User::paginate(10)->onFirstPage();


Last Page:

$users = User::paginate(10)->lastPage();


Total Page:

$users = User::paginate(10)->total();


Hope it can help you.


#laravel #laravel-pagination