当前位置: 首页>>代码示例>>PHP>>正文


PHP Paginator::getPerPage方法代码示例

本文整理汇总了PHP中Paginator::getPerPage方法的典型用法代码示例。如果您正苦于以下问题:PHP Paginator::getPerPage方法的具体用法?PHP Paginator::getPerPage怎么用?PHP Paginator::getPerPage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Paginator的用法示例。


在下文中一共展示了Paginator::getPerPage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: simpleRendeArray

 /**
  * create pagination with only previous and next buttons
  *
  * @return array
  */
 public function simpleRendeArray()
 {
     $array = [];
     $count = $this->paginator->getCount();
     $url = $this->path;
     $current = $this->paginator->getCurrentPage();
     // create appends string
     $appends = $this->createAppendString($this->paginator->getAppends());
     // create fragments string
     $fragments = $this->createFragmentsString($this->paginator->getFragments());
     if ($count < $this->paginator->getPerPage()) {
         $limit = 1;
     } else {
         $limit = ceil($count / $this->paginator->getPerPage());
     }
     if ($this->isAvaibleCurrentPage($current) && $current > 1) {
         $previous = $current - 1;
         $array[] = $this->buildChieldString('Previous', $this->buildFullChieldStrind($url, $appends), $this->pageName, $fragments, $previous);
     }
     if ($this->isAvaibleCurrentPage($current) && $current < $limit) {
         $next = $current + 1;
         $array[] = $this->buildChieldString('Next', $this->buildFullChieldStrind($url, $appends), $this->pageName, $fragments, $next);
     }
     return $array;
 }
开发者ID:AnonymPHP,项目名称:Anonym-Database,代码行数:30,代码来源:Render.php

示例2: respondWithPagination

 /**
  * @param Paginator $items
  * @param $data
  * @return \Illuminate\Http\JsonResponse
  */
 protected function respondWithPagination($items, $data)
 {
     $data = array_merge($data, ['paginator' => ['total_count' => $items->getTotal(), 'total_pages' => ceil($items->getTotal() / $items->getPerPage()), 'current_page' => $items->getCurrentPage(), 'limit' => $items->getPerPage()]]);
     return $this->respond($data);
 }
开发者ID:juaguz,项目名称:apigenerator,代码行数:10,代码来源:ApiController.php

示例3: respondWithPagination

 /**
  * @param Paginator $elements
  * @param $data
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function respondWithPagination(Paginator $elements, $data)
 {
     $data = array_merge($data, ['paginator' => ['totalCount' => $elements->getTotal(), 'totalPages' => ceil($elements->getTotal() / $elements->getPerPage()), 'currentPage' => $elements->getCurrentPage(), 'limit' => $elements->getPerPage()]]);
     return $this->respond($data);
 }
开发者ID:unknownworlds,项目名称:postgre2mongo,代码行数:11,代码来源:BaseApiController.php


注:本文中的Paginator::getPerPage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。