Conditions | 1 |
Paths | 1 |
Total Lines | 27 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
19 | public function inviteList(): ?string |
||
20 | { |
||
21 | // init invite object |
||
22 | $record = new Invite(); |
||
23 | |||
24 | // set current page num and offset |
||
25 | $page = (int)$this->request->query->get('page', 0); |
||
26 | $offset = $page * self::ITEM_PER_PAGE; |
||
|
|||
27 | |||
28 | // prepare pagination data |
||
29 | $pagination = [ |
||
30 | 'url' => ['user/invitelist'], |
||
31 | 'page' => $page, |
||
32 | 'step' => self::ITEM_PER_PAGE, |
||
33 | 'total' => $record->count() |
||
34 | ]; |
||
35 | |||
36 | // get invite list |
||
37 | $records = $record->orderBy('id', 'desc') |
||
38 | ->skip($offset) |
||
39 | ->take(self::ITEM_PER_PAGE) |
||
40 | ->get(); |
||
41 | |||
42 | return $this->view->render('user/invite_list', [ |
||
43 | 'records' => $records, |
||
44 | 'pagination' => $pagination, |
||
45 | 'configs' => $this->getConfigs() |
||
46 | ]); |
||
49 |