1 | <?php |
||||
2 | |||||
3 | namespace Apps\Controller\Admin\Comments; |
||||
4 | |||||
5 | use Apps\ActiveRecord\CommentAnswer; |
||||
6 | use Ffcms\Core\Arch\View; |
||||
7 | use Ffcms\Core\Network\Request; |
||||
8 | use Ffcms\Core\Network\Response; |
||||
9 | |||||
10 | /** |
||||
11 | * Trait ActionAnswerList |
||||
12 | * @package Apps\Controller\Admin\Comments |
||||
13 | * @property Request $request |
||||
14 | * @property Response $response |
||||
15 | * @property View $view |
||||
16 | */ |
||||
17 | trait ActionAnswerList |
||||
18 | { |
||||
19 | /** |
||||
20 | * List answers action |
||||
21 | * @return string |
||||
22 | */ |
||||
23 | public function answerList(): ?string |
||||
24 | { |
||||
25 | // set current page and offset |
||||
26 | $page = (int)$this->request->query->get('page'); |
||||
27 | $offset = $page * self::ITEM_PER_PAGE; |
||||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
28 | |||||
29 | // get result as active records object with offset |
||||
30 | $records = CommentAnswer::orderBy('id', 'desc') |
||||
31 | ->skip($offset) |
||||
32 | ->take(self::ITEM_PER_PAGE) |
||||
33 | ->get(); |
||||
34 | |||||
35 | // render output view |
||||
36 | return $this->view->render('comments/answer_list', [ |
||||
37 | 'records' => $records, |
||||
38 | 'pagination' => [ |
||||
39 | 'url' => ['comments/answerlist'], |
||||
40 | 'page' => $page, |
||||
41 | 'step' => self::ITEM_PER_PAGE, |
||||
42 | 'total' => CommentAnswer::count() |
||||
0 ignored issues
–
show
The method
Ffcms\Core\Arch\ActiveModel::count() is not static, but was called statically.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
43 | ] |
||||
44 | ]); |
||||
45 | } |
||||
46 | } |
||||
47 |