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


PHP LengthAwarePaginator::resolveCurrentPath方法代码示例

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


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

示例1: LengthAwarePaginator

 function length_aware_paginator($items, $perPage, $currentPage = null, array $options = [])
 {
     $currentPage = $currentPage ?: LengthAwarePaginator::resolveCurrentPage();
     $startIndex = $currentPage * $perPage - $perPage;
     $paginatedItems = Collection::make($items)->slice($startIndex, $perPage);
     return new LengthAwarePaginator($paginatedItems, $items->count(), $perPage, $currentPage, ['path' => LengthAwarePaginator::resolveCurrentPath()]);
 }
开发者ID:draperstudio,项目名称:support,代码行数:7,代码来源:Data.php

示例2: getIndex

 /**
  * Show a list of all contacts
  *
  * @return View
  */
 public function getIndex()
 {
     // Title
     $title = 'Boite de réception';
     try {
         $page = Input::get('page', 1);
         $limit = Input::get('limit', 10);
         $sortBy = Input::get('sortBy', 'created_at');
         $sortDirection = Input::get('sortDirection', 'desc');
         $data = $this->model->getByPage($page, $limit, $sortBy, $sortDirection, []);
         $totalItems = $data->totalItems;
         $limit = $data->limit;
         $models = new Paginator($data->items, $data->totalItems, $data->limit, $page, ['path' => Paginator::resolveCurrentPath()]);
     } catch (RequestException $e) {
         echo $e->getRequest() . "\n";
         if ($e->hasResponse()) {
             echo $e->getResponse() . "\n";
         }
         exit;
     }
     JavaScript::put(['locale' => LaravelLocalization::setLocale(), 'collection' => $models->getcollection()->toJson()]);
     $data = array('title' => $title, 'models' => $models, 'modelBreacrumbs' => '', 'totalItems' => $totalItems, 'limit' => $limit, 'sortBy' => $sortBy, 'sortDirection' => $sortDirection, 'routes' => array('create' => 'admin/contacts/create', 'export' => 'admin/contacts/export'));
     // Show the page
     return View::make('admin.index', $data);
 }
开发者ID:khaledof,项目名称:brikaCms,代码行数:30,代码来源:AdminContactsController.php

示例3: __construct

 /**
  * PlasticPaginator constructor.
  *
  * @param PlasticResult $result
  * @param int           $limit
  * @param int           $page
  */
 public function __construct(PlasticResult $result, $limit, $page)
 {
     $this->result = $result;
     parent::__construct($result->hits(), $result->totalHits(), $limit, $page, ['path' => LengthAwarePaginator::resolveCurrentPath()]);
     $hitsReference =& $this->items;
     $result->setHits($hitsReference);
 }
开发者ID:sleimanx2,项目名称:plastic,代码行数:14,代码来源:PlasticPaginator.php

示例4: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Support\Facades\Response
  */
 public function index()
 {
     $page = Input::get('page');
     $perPage = config('typicms.news.per_page');
     $data = $this->repository->byPage($page, $perPage, ['translations']);
     $models = new Paginator($data->items, $data->totalItems, $perPage, null, ['path' => Paginator::resolveCurrentPath()]);
     return view('news::public.index')->with(compact('models'));
 }
开发者ID:donchopetrov,项目名称:News,代码行数:13,代码来源:PublicController.php

示例5: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\View\View
  */
 public function index()
 {
     $page = Request::input('page');
     $perPage = config('typicms.galleries.per_page');
     $data = $this->repository->byPage($page, $perPage, []);
     $models = new Paginator($data->items, $data->totalItems, $perPage, null, ['path' => Paginator::resolveCurrentPath()]);
     return view('galleries::public.index')->with(compact('models'));
 }
开发者ID:webfactorybulgaria,项目名称:Galleries,代码行数:13,代码来源:PublicController.php

示例6: getListWithPaginate

 public static function getListWithPaginate($paginator = 0, $status = null, $fields = ['*'])
 {
     $query = self::select($fields);
     if ($status) {
         $query->ofStatus($status);
     }
     $freeproducts = $query->get();
     return $paginator ? new Paginator(self::getWithProducts($freeproducts), $freeproducts->count(), $paginator, Paginator::resolveCurrentPage(), ['path' => Paginator::resolveCurrentPath()]) : self::getWithProducts($freeproducts);
 }
开发者ID:masterpowers,项目名称:antVel,代码行数:9,代码来源:FreeProduct.php

示例7: index

 /**
  * List files.
  *
  * @return \Illuminate\View\View
  */
 public function index()
 {
     $page = Request::input('page');
     $type = Request::input('type');
     $gallery_id = Request::input('gallery_id');
     $view = Request::input('view');
     if ($view != 'filepicker') {
         $view = 'index';
         $models = $this->repository->all([], true);
         app('JavaScript')->put('models', $models);
     } else {
         $perPage = config('typicms.files.per_page');
         $data = $this->repository->byPageFrom($page, $perPage, $gallery_id, [], true, $type);
         $models = new Paginator($data->items, $data->totalItems, $perPage, null, ['path' => Paginator::resolveCurrentPath()]);
     }
     return view('files::admin.' . $view)->with(compact('models'));
 }
开发者ID:webfactorybulgaria,项目名称:Files,代码行数:22,代码来源:AdminController.php

示例8: paginate

 /**
  * Return Laravel pagination instance.
  *
  * @return LengthAwarePaginator
  */
 public function paginate()
 {
     return new LengthAwarePaginator($this->items, $this->getMeta('pagination.total'), $this->getMeta('pagination.per_page'), $this->getMeta('pagination.current_page'), ['path' => LengthAwarePaginator::resolveCurrentPath()]);
 }
开发者ID:torann,项目名称:api-client,代码行数:9,代码来源:Collection.php

示例9: paginateHydrate

 /**
  * Paginate items.
  *
  * @param  array  $result
  * @param  string $modelClass
  *
  * @return \Illuminate\Pagination\LengthAwarePaginator
  */
 public function paginateHydrate($result, $modelClass = null)
 {
     // Get values
     $pagination = array_get($result, 'pagination', []);
     $items = array_get($result, 'items', []);
     $currentPage = array_get($pagination, 'next', 2) - 1;
     // Set pagination
     $perPage = array_get($pagination, 'perPage', array_get($pagination, 'per_page', 15));
     $total = array_get($pagination, 'total', null);
     // @deprecated
     if ($total === null) {
         $total = $perPage * array_get($pagination, 'last', 0);
     }
     // Set options
     $options = is_array($result) ? array_except($result, ['pagination', 'items', 'next', 'per_page', 'last']) : [];
     return new LengthAwarePaginator($this->hydrate($items, $modelClass), $total, $perPage, $currentPage, array_merge($options, ['path' => LengthAwarePaginator::resolveCurrentPath()]));
 }
开发者ID:torann,项目名称:remote-model,代码行数:25,代码来源:Model.php

示例10: getAll

 /**
  * Get All notifications
  *
  * @param           $to_id
  * @param           $limit
  * @param  int|null $paginate
  * @param  string   $orderDate
  * @param Closure   $filterScope
  * @return mixed
  */
 public function getAll($to_id, $limit = null, $paginate = null, $orderDate = 'desc', Closure $filterScope = null)
 {
     $notifications = $this->notifynderRepo->getAll($to_id, $this->entity, $limit, $paginate, $orderDate, $filterScope);
     if (is_int(intval($paginate)) && $paginate) {
         return new LengthAwarePaginator($notifications->parse(), $notifications->total(), $limit, $paginate, ['path' => LengthAwarePaginator::resolveCurrentPath()]);
     }
     return $notifications->parse();
 }
开发者ID:computerfr33k,项目名称:Notifynder,代码行数:18,代码来源:NotificationManager.php

示例11: myActivitySorting

    public function myActivitySorting($sort_by, $id)
    {
        if (Auth::check()) {
            $title = 'mypost';
            if (Auth::user()->identifier == 1 || Auth::user()->identifier == 2) {
                $posts = Postjob::where('unique_id', '=', $id)->leftjoin('postactivities', 'postactivities.post_id', '=', 'postjobs.id');
                if ($sort_by == 'date') {
                    $posts->orderBy('postactivities.created_at', 'asc')->with('indUser', 'corpUser', 'postActivity', 'taggedUser', 'taggedGroup')->where('postjobs.individual_id', '!=', Auth::user()->induser_id)->paginate(15);
                } elseif ($sort_by == 'magic-match') {
                    $posts = Postjob::orderBy('created_at', 'asc')->with('indUser', 'corpUser', 'postActivity', 'taggedUser', 'taggedGroup')->where('individual_id', '!=', Auth::user()->induser_id)->get();
                    $posts = $posts->sortBy(function ($jobPost) {
                        return -$jobPost->magic_match;
                    });
                    $perPage = 15;
                    $pageStart = \Request::get('page', 1);
                    // Start displaying items from this number;
                    $offSet = $pageStart * $perPage - $perPage;
                    // Get only the items you need using array_slice
                    $itemsForCurrentPage = $posts->slice($offSet, $perPage)->all();
                    $posts = new LengthAwarePaginator($itemsForCurrentPage, count($posts), $perPage, LengthAwarePaginator::resolveCurrentPage(), array('path' => LengthAwarePaginator::resolveCurrentPath()));
                } elseif ($sort_by == 'individual') {
                    $posts = Postjob::orderByRaw(DB::raw('CASE WHEN postjobs.individual_id IS NULL THEN "corp" ELSE "ind" END DESC'))->orderBy('id', 'desc')->with('indUser', 'corpUser', 'postActivity', 'taggedUser', 'taggedGroup')->where('post_type', '=', 'job')->where('individual_id', '!=', Auth::user()->induser_id)->paginate(15);
                } elseif ($sort_by == 'corporate') {
                    $posts = Postjob::orderByRaw(DB::raw('CASE WHEN postjobs.corporate_id IS NULL THEN "ind" ELSE "corp" END ASC'))->orderBy('id', 'desc')->with('indUser', 'corpUser', 'postActivity', 'taggedUser', 'taggedGroup')->where('post_type', '=', 'job')->where('individual_id', '!=', Auth::user()->induser_id)->paginate(15);
                } else {
                    $posts = Postjob::orderBy('created_at', 'desc')->with('indUser', 'corpUser', 'postActivity', 'taggedUser', 'taggedGroup')->where('post_type', '=', 'job')->where('individual_id', '!=', Auth::user()->induser_id)->paginate(15);
                }
                $myActivities = DB::select('(select pa.id,pa.user_id,pa.post_id,"Thanks" as identifier,pa.thanks as activity, pa.thanks_dtTime as time,pj.unique_id, pj.post_title, pj.post_compname
										from postactivities pa 
										join postjobs pj on pj.id = pa.post_id
										where pa.user_id=? and pa.thanks = 1)
										union
										(select pa.id,pa.user_id,pa.post_id,"Shared" as identifier,pa.share as share, pa.share_dtTime as time,pj.unique_id, pj.post_title, pj.post_compname
										from postactivities pa 
										join postjobs pj on pj.id = pa.post_id
										where pa.user_id=? and pa.share = 1)
										union
										(select pa.id,pa.user_id,pa.post_id,"Applied" as identifier,pa.apply as activity, pa.apply_dtTime as time,pj.unique_id,pj.post_title, pj.post_compname
										from postactivities pa 
										join postjobs pj on pj.id = pa.post_id
										where pa.user_id=? and pa.apply = 1)
										union
										(select pa.id,pa.user_id,pa.post_id,"Contacted" as identifier,pa.contact_view as activity,pa.contact_view_dtTime as time,pj.unique_id, pj.post_title, pj.post_compname
										from postactivities pa 
										join postjobs pj on pj.id = pa.post_id
										where pa.user_id=? and pa.contact_view = 1)
										order by time desc', [Auth::user()->id, Auth::user()->id, Auth::user()->id, Auth::user()->id]);
                $myActivities = collect($myActivities);
                if (Auth::user()->identifier == 1) {
                    $share_links = Induser::whereRaw('indusers.id in (
													select connections.user_id as id from connections
													where connections.connection_user_id=?
													 and connections.status=1
													union 
													select connections.connection_user_id as id from connections
													where connections.user_id=?
													 and connections.status=1
										)', [Auth::user()->induser_id, Auth::user()->induser_id])->get(['id', 'fname'])->lists('fname', 'id');
                    $share_groups = Group::leftjoin('groups_users', 'groups_users.group_id', '=', 'groups.id')->where('groups.admin_id', '=', Auth::user()->induser_id)->orWhere('groups_users.user_id', '=', Auth::user()->induser_id)->groupBy('groups.id')->get(['groups.id as id', 'groups.group_name as name'])->lists('name', 'id');
                }
                return view('pages.mypost', compact('posts', 'title', 'myActivities', 'share_groups', 'share_links'));
            }
        } else {
            return redirect('login');
        }
    }
开发者ID:devvicky,项目名称:Jobb-new,代码行数:66,代码来源:PagesController.php

示例12: getPaginatedIfNeeded

 protected function getPaginatedIfNeeded(NotifynderCollection $notifications, $perPage, $paginate)
 {
     if (!$this->isPaginated($paginate)) {
         return $notifications->parse();
     } elseif ($paginate === true) {
         $paginate = null;
     }
     $page = LengthAwarePaginator::resolveCurrentPage();
     $total = $notifications->count();
     $notifications = $notifications->forPage($page, $perPage);
     return new LengthAwarePaginator($notifications->parse(), $total, $perPage, $paginate, ['path' => LengthAwarePaginator::resolveCurrentPath()]);
 }
开发者ID:fenos,项目名称:notifynder,代码行数:12,代码来源:NotificationManager.php


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