Ejemplo n.º 1
0
 function page($query = [], $fields = [], $sort = null, $page = 1, $pagesize = 50)
 {
     $query = $this->getQueryByTrashStatus($query);
     if ($page < 1) {
         $page = 1;
     }
     if ($pagesize < 1) {
         $pagesize = 50;
     }
     $skip = ($page - 1) * $pagesize;
     $total = parent::count($query);
     $list = parent::all($query, $fields, $sort, $pagesize, $skip);
     $pagemax = ceil($total / $pagesize);
     return [$list, compact('total', 'page', 'pagesize', 'pagemax')];
 }