Update paginator.md

This commit is contained in:
黄朝晖 2020-01-07 15:18:29 +08:00 committed by GitHub
parent 237c0bc6df
commit 4f74f0cd32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,14 +30,14 @@ class UserController
public function index(RequestInterface $request)
{
$currentPage = $request->input('page', 1);
$perPage = 2;
$perPage = $request->input('per_page', 2);
$users = [
['id' => 1, 'name' => 'Tom'],
['id' => 2, 'name' => 'Sam'],
['id' => 3, 'name' => 'Tim'],
['id' => 4, 'name' => 'Joe'],
];
return new Paginator($users, $perPage, (int)$currentPage);
return new Paginator($users, (int) $perPage, (int) $currentPage);
}
}
```