本文整理汇总了PHP中Illuminate\Database\Connection::getPaginator方法的典型用法代码示例。如果您正苦于以下问题:PHP Connection::getPaginator方法的具体用法?PHP Connection::getPaginator怎么用?PHP Connection::getPaginator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\Connection
的用法示例。
在下文中一共展示了Connection::getPaginator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: simplePaginate
/**
* Get a paginator only supporting simple next and previous links.
*
* This is more efficient on larger data-sets, etc.
*
* @param int $perPage
* @param array $columns
* @return \Illuminate\Pagination\Paginator
*/
public function simplePaginate($perPage = null, $columns = array('*'))
{
$paginator = $this->connection->getPaginator();
$page = $paginator->getCurrentPage();
$perPage = $perPage ?: $this->model->getPerPage();
$this->skip(($page - 1) * $perPage)->take($perPage + 1);
return $paginator->make($this->get($columns), $perPage);
}
示例2: paginate
/**
* Get a paginator for the "select" statement.
*
* @param int $perPage
* @param array $columns
* @return \Illuminate\Pagination\Paginator
*/
public function paginate($perPage = 15, $columns = array('*'))
{
$paginator = $this->connection->getPaginator();
if (isset($this->groups)) {
return $this->groupedPaginate($paginator, $perPage, $columns);
} else {
return $this->ungroupedPaginate($paginator, $perPage, $columns);
}
}