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


PHP Paginator::toArray方法代码示例

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


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

示例1: transformPaginator

 private function transformPaginator(Paginator $paginator)
 {
     $array = $paginator->toArray();
     unset($array['data']);
     // Add pagination info
     $current_page = $paginator->getCurrentPage();
     $next_page = min($current_page + 1, $paginator->getLastPage());
     $previous_page = max($current_page - 1, 1);
     $array['next_page'] = $next_page === $current_page ? NULL : $paginator->getUrl($next_page);
     $array['previous_page'] = $previous_page === $current_page ? NULL : $paginator->getUrl($previous_page);
     return $array;
 }
开发者ID:aaronbullard,项目名称:litmus,代码行数:12,代码来源:PaginatorTransformer.php

示例2: DataGrid

 public function DataGrid()
 {
     $users = $this->userRepository->all();
     // dd(get_class($this->groupRepository));
     // print_r($users);
     // dd($users);
     $perPage = 15;
     $currentPage = Input::get('page') - 1;
     $pagedData = array_slice($users, $currentPage * $perPage, $perPage);
     $users = new Paginator($pagedData, $perPage, $currentPage);
     // dd($users);
     $data['total'] = count($users->toArray());
     // dd($users->toArray());
     $datagrab = $users->toArray()['data'];
     foreach ($users as $key => $user) {
         // dd( array_flip( $group->getPermissions()));
         $datagrab[$key]['id'] = $user->hash;
         $datagrab[$key]['permissions'] = implode(",", array_flip($user->getPermissions()));
     }
     $data['rows'] = $datagrab;
     return json_encode($data);
 }
开发者ID:acmadi,项目名称:integrasi,代码行数:22,代码来源:UserController.php


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