app/models/Data/User.php: adding getPagination()
This commit is contained in:
parent
3c17346e46
commit
dfe440cda3
1 changed files with 20 additions and 0 deletions
|
|
@ -455,4 +455,24 @@ class User extends Base
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $page
|
||||||
|
* @param int $limit
|
||||||
|
* @return \Phalcon\Paginator\AdapterInterface
|
||||||
|
*/
|
||||||
|
public static function getPaginationList($page = 1, $limit = 30)
|
||||||
|
{
|
||||||
|
$builder = (new self())->getModelsManager()->createBuilder();
|
||||||
|
|
||||||
|
$builder->from(self::class);
|
||||||
|
|
||||||
|
$paginator = new \Phalcon\Paginator\Adapter\QueryBuilder(array(
|
||||||
|
'builder' => $builder,
|
||||||
|
'page' => $page,
|
||||||
|
'limit' => $limit
|
||||||
|
));
|
||||||
|
|
||||||
|
return $paginator;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in a new issue