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


PHP LengthAwarePaginator::count方法代码示例

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


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

示例1: search

 /**
  * @return mixed
  */
 public function search()
 {
     $query = Input::get('q');
     $order_by = null !== Input::get('field') ? Input::get('field') : 'id';
     $sort = null !== Input::get('sort') ? Input::get('sort') : 'asc';
     $user = $this->users->searchUsers($query, true, $order_by, $sort);
     $total = $user->count();
     $pageName = 'page';
     $per_page = config('access.users.default_per_page');
     $page = null;
     //Create custom pagination
     $users = new LengthAwarePaginator($user, $total, $per_page, $page, ['path' => Paginator::resolveCurrentPath(), 'pageName' => $pageName]);
     if ($users->count() == 0) {
         return redirect()->route('admin.access.users.index')->withFlashDanger('Your search term "' . $query . '" not found!');
     }
     return view('backend.access.index', compact('users'))->withRoles($this->roles->getAllRoles('id', 'asc', true));
 }
开发者ID:herzcthu,项目名称:Laravel-HS,代码行数:20,代码来源:UserController.php

示例2: respondWithPagination

 /**
  * @param LengthAwarePaginator $paginatorData
  * @param           $data
  *
  * @return mixed
  */
 public function respondWithPagination(LengthAwarePaginator $paginatorData, $data)
 {
     $data = array_merge($data, ['paginator' => ['total_count' => $paginatorData->total(), 'total_pages' => ceil($paginatorData->total() / $paginatorData->perPage()), 'current_page' => $paginatorData->currentPage(), 'limit' => $paginatorData->count(), 'next_page_url' => $paginatorData->nextPageUrl()]]);
     return $this->respond($data);
 }
开发者ID:ahk-ch,项目名称:chamb.net,代码行数:11,代码来源:ApiResponse.php

示例3: checkPagination

 /**
  * Redirect to page 1 if the paginator is empty.
  * @param \Illuminate\Pagination\LengthAwarePaginator $paginator
  * @return \Illuminate\Support\Facades\Redirect
  */
 protected function checkPagination(LengthAwarePaginator $paginator)
 {
     if ($paginator->count() == 0 && !is_null(Input::get('page')) && (int) Input::get('page') != 1) {
         App::abort(Response::HTTP_TEMPORARY_REDIRECT, '', ['Location' => route(Route::current()->getName(), Input::except('page') + ['page' => 1])]);
     }
 }
开发者ID:backstagetechnicalservices,项目名称:website,代码行数:11,代码来源:Controller.php

示例4: paginate

 public function paginate(LengthAwarePaginator $paginator)
 {
     return ["count" => $paginator->count(), "current_page" => $paginator->currentPage(), "last_page" => $paginator->lastPage(), "per_page" => $paginator->perPage(), "total" => $paginator->total()];
 }
开发者ID:hrobinson,项目名称:laravel-core,代码行数:4,代码来源:PaginationService.php

示例5: tableNavStatus

 /**
  * @param LengthAwarePaginator $paginated_list
  * @return string
  */
 public function tableNavStatus(LengthAwarePaginator $paginated_list)
 {
     return trans('global.table_list.results.status', ['start' => $paginated_list->perPage() * ($paginated_list->currentPage() - 1) + 1, 'stop' => $paginated_list->count() + ($paginated_list->currentPage() - 1) * $paginated_list->perPage(), 'total' => $paginated_list->total()]);
 }
开发者ID:Okipa,项目名称:una.app,代码行数:8,代码来源:TableListHelper.php


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