PHP code example of danbovey / laravel-linkheader-paginator
1. Go to this page and download the library: Download danbovey/laravel-linkheader-paginator library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
danbovey / laravel-linkheader-paginator example snippets
$items = User::where('active', 1)->paginate(20);
$paginator = new LengthAwarePaginator($items);
return $paginator->toResponse();
$page = $request->get('page');
$perPage = 20;
// Take one more than needed to see if there is a next page
$users = User::skip(($page - 1) * $perPage)
->take($perPage + 1);
$paginator = new Paginator($simple, $items);
return $paginator->toResponse();