Skip to content

Latest commit

 

History

History
38 lines (32 loc) · 713 Bytes

readme.md

File metadata and controls

38 lines (32 loc) · 713 Bytes

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