當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。