2017 © Pedro Peláez
 

library pagination

Laravel pagination on steroids

image

desmart/pagination

Laravel pagination on steroids

  • Tuesday, March 10, 2015
  • by DeSmart
  • Repository
  • 11 Watchers
  • 37 Stars
  • 5,085 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 7 Forks
  • 1 Open issues
  • 10 Versions
  • 4 % Grown

The README.md

Overview

Build Status, (*1)

This package is an extension for Laravel4 pagination module., (*2)

It provides new functionalities:, (*3)

  • route based url generator
  • helpers for template render

Installation

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

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

Compatibilty

This package should not break compatibility with Laravel pagination module., (*6)

Laravel 4.1

To use desmart/pagination with Laravel 4.1 switch to version 1.1.*., (*7)

Laravel 4.0

To use desmart/pagination with Laravel 4.0 switch to version 1.0.*., (*8)

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)

The Versions

10/03 2015

dev-master

9999999-dev

Laravel pagination on steroids

  Sources   Download

MIT

The Requires

 

The Development Requires

by Radoslaw Mejer

laravel pagination

10/03 2015

dev-upgrade-to-laravel-51

dev-upgrade-to-laravel-51

Laravel pagination on steroids

  Sources   Download

MIT

The Requires

 

The Development Requires

by Radoslaw Mejer

laravel pagination

10/03 2015

1.2.1

1.2.1.0

Laravel pagination on steroids

  Sources   Download

MIT

The Requires

 

The Development Requires

by Radoslaw Mejer

laravel pagination

16/06 2014

1.2.0

1.2.0.0

Laravel pagination on steroids

  Sources   Download

MIT

The Requires

 

The Development Requires

by Radoslaw Mejer

laravel pagination

23/01 2014

1.1.1

1.1.1.0

Laravel pagination on steroids

  Sources   Download

MIT

The Requires

 

The Development Requires

by Radoslaw Mejer

laravel pagination

03/12 2013

1.1.0

1.1.0.0

Laravel pagination on steroids

  Sources   Download

MIT

The Requires

 

The Development Requires

by Radoslaw Mejer

laravel pagination

03/12 2013

1.0.3

1.0.3.0

Laravel pagination on steroids

  Sources   Download

MIT

The Requires

 

The Development Requires

by Radoslaw Mejer

laravel pagination

22/07 2013

1.0.2

1.0.2.0

Laravel pagination on steroids

  Sources   Download

MIT

The Requires

 

The Development Requires

by Radoslaw Mejer

laravel pagination

12/06 2013

1.0.1

1.0.1.0

Laravel pagination on steroids

  Sources   Download

MIT

The Requires

 

The Development Requires

by Radoslaw Mejer

laravel pagination

11/06 2013

1.0.0

1.0.0.0

Laravel pagination on steroids

  Sources   Download

The Requires

 

The Development Requires

by Radoslaw Mejer