mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-03 04:08:01 +08:00
Update paginator.md
This commit is contained in:
parent
237c0bc6df
commit
4f74f0cd32
@ -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);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user