StudentController.php 779 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace backend\controllers;
  3. use common\models\xhTrainStudent;
  4. use Yii;
  5. use yii\web\Controller;
  6. use yii\filters\AccessControl;
  7. use yii\data\Pagination;
  8. /**
  9. * student controller
  10. */
  11. class StudentController extends BackendController
  12. {
  13. public function actionList()
  14. {
  15. $query = xhTrainStudent::find();
  16. $query->where(['merchantId' =>$this->merchantId]);
  17. $query->orderBy('id desc');
  18. $countQuery = clone $query;
  19. $pages = new Pagination(['totalCount' => $countQuery->count(),'pageSize' => 20]);
  20. $models = $query->offset($pages->offset)->limit($pages->limit)->all();
  21. return $this->render('list', ['models' => $models,'pages' => $pages]);
  22. }
  23. public function actionShow()
  24. {
  25. return $this->render('show');
  26. }
  27. }