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


PHP Paginator::currentPageResolver方法代码示例

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


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

示例1: list

 static function list($number, $page)
 {
     Paginator::currentPageResolver(function () use($page) {
         return $page;
     });
     return self::show("*")->paginate($number);
 }
开发者ID:marcocastignoli,项目名称:lumen_auth,代码行数:7,代码来源:User.php

示例2: readLog

 public static function readLog($deviceId, $page)
 {
     Paginator::currentPageResolver(function () use($page) {
         return $page;
     });
     return LocationLog::where('device_id', $deviceId)->orderBy('location_time', 'DESC')->simplePaginate(config('custom.item_per_page'))->all();
 }
开发者ID:emyeuheo,项目名称:phonetracker,代码行数:7,代码来源:LocationLog.php

示例3: validateQuery

 public function validateQuery(Request $request)
 {
     $modelClass = $this->model;
     $queryBuilder = new $modelClass();
     if (count($parameters = $request->all()) > 0) {
         $handledRequestParameters = $this->handleRequestParameters($parameters);
         if (isset($handledRequestParameters['queries'])) {
             foreach ($handledRequestParameters['queries'] as $query) {
                 $queryBuilder = $this->handleQuery($queryBuilder, $query);
             }
         }
         if (isset($handledRequestParameters['take'])) {
             $queryBuilder = $queryBuilder->take($handledRequestParameters['take']);
         } else {
             if (isset($handledRequestParameters['pagination'])) {
                 $currentPage = $handledRequestParameters['pagination']['page'];
                 Paginator::currentPageResolver(function () use($currentPage) {
                     return $currentPage;
                 });
                 return $queryBuilder = $queryBuilder->paginate($handledRequestParameters['pagination']['paginate'])->setPath($this->getUrlParameters($request));
             }
         }
     }
     return $queryBuilder->get();
 }
开发者ID:paulvl,项目名称:faztortest,代码行数:25,代码来源:QueryingRequests.php

示例4: handle

 /**
  * Set the current page based on the page route parameter before the route's action is executed.
  *
  * @return \Illuminate\Http\Request
  */
 public function handle($request, Closure $next)
 {
     Paginator::currentPageResolver(function () {
         return app('paginateroute')->currentPage();
     });
     return $next($request);
 }
开发者ID:willemvb,项目名称:laravel-paginateroute,代码行数:12,代码来源:SetPageMiddleware.php

示例5: handle

 /**
  * Set the current page based on the page route parameter before the route's action is executed.
  * 
  * @return \Illuminate\Http\Request
  */
 public function handle($request, Closure $next)
 {
     $page = Route::getCurrentRoute()->parameter('page', 1);
     Paginator::currentPageResolver(function () use($page) {
         return $page;
     });
     return $next($request);
 }
开发者ID:jjsquad,项目名称:laravel-paginateroute,代码行数:13,代码来源:SetPageMiddleware.php

示例6: register

 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     Paginator::currentPathResolver(function () {
         return $this->app['request']->url();
     });
     Paginator::currentPageResolver(function () {
         return $this->app['request']->input('page');
     });
 }
开发者ID:visualturk,项目名称:framework,代码行数:14,代码来源:PaginationServiceProvider.php

示例7: __construct

 public function __construct($transformer, $castTransformer, $merge, PaginationRequest $request, $defaultSort = false)
 {
     parent::__construct($transformer, $castTransformer, $merge);
     $this->request = $request;
     $this->defaultSort = $defaultSort;
     Paginator::currentPageResolver(function () {
         return $this->request->input(join('.', [$this->pageName, $this->pageNumber]), 1);
     });
 }
开发者ID:lemax10,项目名称:json-transformer,代码行数:9,代码来源:PaginateTransformer.php

示例8: register

 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     Paginator::currentPathResolver(function () {
         return $this->app['slim']->request->getResourceUri();
     });
     Paginator::currentPageResolver(function ($pageName = 'page') {
         return $this->app['slim']->request->params($pageName);
     });
 }
开发者ID:efracuadras,项目名称:slimgeek,代码行数:14,代码来源:PaginationServiceProvider.php

示例9: list

 public function list(Request $request)
 {
     $number = $request->has('request') ? $request->number : 15;
     $page = $request->has('page') ? $request->page : 1;
     Paginator::currentPageResolver(function () use($page) {
         return $page;
     });
     return self::show("*", new Authorization())->paginate($number);
 }
开发者ID:marcocastignoli,项目名称:lumen_auth,代码行数:9,代码来源:AuthorizationController.php

示例10: parseRequestPagination

 private function parseRequestPagination($query)
 {
     $page = (int) $this->getHttp()->getInput('page', 1);
     $offset = (int) $this->getHttp()->getInput('offset', 2);
     \Illuminate\Pagination\Paginator::currentPageResolver(function () use($page) {
         return $page;
     });
     return $query->paginate($offset);
 }
开发者ID:beeblebrox3,项目名称:devshop,代码行数:9,代码来源:Devs.php

示例11: setup

 /**
  * Setup the pagination service.
  *
  * @param \Slim\Slim $app The application instance.
  */
 public static function setup(Slim $app)
 {
     $key = $app->config('pagination.key');
     if (empty($key)) {
         $key = 'page';
     }
     Paginator::currentPageResolver(function () use($app, $key) {
         return $app->request->get($key);
     });
 }
开发者ID:creativeduo,项目名称:thin,代码行数:15,代码来源:Pagination.php

示例12: getRepliesWithLimit

 public function getRepliesWithLimit($limit = 30)
 {
     Paginator::currentPageResolver(function ($pageName) use($limit) {
         $page = app('request')->input($pageName);
         if (filter_var($page, FILTER_VALIDATE_INT) !== false && (int) $page >= 1) {
             return $page;
         }
         return ceil($this->reply_count / $limit);
     });
     return $this->replies()->orderBy('created_at', 'asc')->with('user')->paginate($limit);
 }
开发者ID:yhbyun,项目名称:l5-forum,代码行数:11,代码来源:Topic.php

示例13: setCurrentPage

 /**
  * 设置分页对象的当前页
  */
 protected function setCurrentPage()
 {
     $page = Input::get(self::getParameterKeyPage());
     $pageSize = Input::get(self::getParameterKeyPageSize());
     // validate parameters
     self::validatePaginationParameters($page, $pageSize);
     Paginator::currentPageResolver(function () use($page) {
         return $page;
     });
     return $pageSize;
 }
开发者ID:loopeer,项目名称:quickcms,代码行数:14,代码来源:BaseController.php

示例14: index

 public function index(Request $request)
 {
     if (!($limit = $request->get('limit'))) {
         $limit = 25;
     }
     if ($currentPage = $request->get('page')) {
         Paginator::currentPageResolver(function () use($currentPage) {
             return $currentPage;
         });
     }
     $users = User::paginate($limit);
     return $this->response->paginator($users, new UserTransformer());
 }
开发者ID:Sarav-S,项目名称:Experimenting-Lumen,代码行数:13,代码来源:UserController.php

示例15: index

 /**
  * server 运行状态
  * @param Request $request
  * @return \Symfony\Component\HttpFoundation\Response
  *
  * @api {get} /status 查询运行状态
  * @apiName PostRegister
  * @apiGroup Status
  */
 public function index(Request $request)
 {
     $currentPage = 1;
     if ($request->has('page')) {
         $currentPage = $request->input('page');
         Paginator::currentPageResolver(function () use($currentPage) {
             return $currentPage;
         });
     }
     $per_page = $request->has('per_page') ? $request->input('per_page') : 20;
     $result = Notice::orderBy('id', 'DESC')->paginate($per_page)->toArray();
     return view('status', ['notice' => $result['data'], 'current_page' => $currentPage, 'last_page' => $result['last_page']]);
 }
开发者ID:YunzhanghuOpen,项目名称:server-demo,代码行数:22,代码来源:StatusController.php


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