Skip to content

heseya/laravel-pagination

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Heseya Pagination Middleware

Middleware that automatically sets pagination for all endpoints.

How it's work?

You add middleware in App\Http\Kernel

protected $middleware = [
    ...
    Heseya\Pagination\Http\Middleware\Pagination::class,
];

or to specific route in router

Route::get(...)->middleware(Pagination::class);

Now when you send parameter limit

/products?limit=50

you can use pagination.per_page config key to set pagination limit

public function index()
{
    return Product::paginate(Config::get('pagination.per_page'));
}

Installation

composer require heseya/laravel-pagination
php artisan vendor:publish --tag=pagination