承接 desmart/pagination 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

desmart/pagination

最新稳定版本:1.2.1

Composer 安装命令:

composer require desmart/pagination

包简介

Laravel pagination on steroids

README 文档

README

Build Status

This package is an extension for Laravel4 pagination module.

It provides new functionalities:

  • route based url generator
  • helpers for template render

Installation

To composer.json add: "desmart/pagination": "1.2.*" and then run composer update desmart/pagination.

In app/config/app.php replace line 'Illuminate\Pagination\PaginationServiceProvider', with 'DeSmart\Pagination\PaginationServiceProvider',.

Compatibilty

This package should not break compatibility with Laravel pagination module.

Laravel 4.1

To use desmart/pagination with Laravel 4.1 switch to version 1.1.*.

Laravel 4.0

To use desmart/pagination with Laravel 4.0 switch to version 1.0.*.

Method overview

General usage

  • withQuery() - bind query parameters to url generator (by default query parameters are included). Works only for url generating from routes.
  • withoutQuery() - don't bind query parameters
  • route($route[, array $parameters]) - use given route for generating url to pages (it can be route name, or instance of Illuminate\Routing\Route)
  • useCurrentRoute() - use current (active) route for url generating

For templates

  • pagesProximity($proximity) - set pages proximity
  • getPagesRange() - get list of pages to show in template (includes proximity)
  • canShowFirstPage() - check if can show first page (returns TRUE when first page is not in list generated by getPagesRange())
  • canShowLastPage() - check if can show last page (returns TRUE when last page is not in list generated by getPagesRange())

Example usage

In controller

// example route (app/routes.php)
Route::get('/products/{page}.html', array('as' => 'products.list', 'uses' => ''));

// use the current route
$list = Product::paginate(10)
  ->useCurrentRoute()
  ->pagesProximity(3);
  
// use custom route
$list = Product::paginate(10)
  ->route('products.list')
  ->pagesProximity(3);

In view

// app/view/products/list.blade.php

@foreach ($list as $item)
{{-- show item --}}
@endforeach

{{ $list->links('products.paginator') }}

// app/view/products/paginator.blade.php

@if ($paginator->getLastPage() > 1)
  @foreach ($paginator->getPagesRange() as $page)
    {{ $page }}
  @endforeach
@endif

License

This package is open-sourced software licensed under the MIT license

统计信息

  • 总下载量: 9.12k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 41
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 40
  • Watchers: 15
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-06-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固