| Package Data | |
|---|---|
| Maintainer Username: | thinkworld |
| Maintainer Contact: | i@yea.im (ThinkWorld) |
| Package Create Date: | 2015-06-02 |
| Package Last Update: | 2019-01-26 |
| Home Page: | |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-11-03 15:24:10 |
| Package Statistics | |
|---|---|
| Total Downloads: | 281 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 2 |
| Total Watchers: | 1 |
| Total Forks: | 0 |
| Total Open Issues: | 0 |
if use laravel4.0/laravel4.1/laravel4.2 click this: https://packagist.org/packages/desmart/pagination
This package is an extension for Laravel5 pagination module. Modified from desmart / pagination Thanks radmen https://github.com/DeSmart/pagination
It provides new functionalities:
To composer.json add: "thinkme/pagination": "dev-master" and then run composer update thinkme/pagination.
This package should not break compatibility with Laravel pagination module.
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 parametersroute($route[, array $parameters]) - use given route for generating url to pages (it can be route name, or instance of Illuminate\Routing\Route)pagesProximity($proximity) - set pages proximitygetPagesRange() - 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 route (routes.php)
Route::get('list-{page}.html', ['as' => 'list.page', 'uses' => 'PhotoController@index']);
// IF use the current route
$list = new Paginator();
$list = list->make($item, $count, 1, $page, [
'path' => Paginator::resolveCurrentPath(),
]);
$list->route('list.page');
$list->pagesProximity(3);
// or quick paginator
$query = User::select($columns);
$paginate = new Paginator();
$paginate->paginate($query, 10);//or $paginate->paginate($query, $perPage, $currentPage);
//or $list = $paginate ^#*&!^#*!^&*(!&#) You know;
//return $list
return $paginate;
//IF you do not want to use the default page name. Example: http://test.com?page=1 to http://test.com?p=1
$paginate->paginate($query, $perPage, $currentPage, ['pageName' => 'p']);//http://test.com?p=1
//or
$paginate->setPageName('p');
// IF use yourself Presenter Class
Paginator::presenter(function() use ($list) {
return new MyPresenter($list);
});
// list.blade.php
@foreach ($list as $item)
{{-- show item --}}
@endforeach
{!! $list->links('paginator') !!}
// if use yourself Presenter Class
{!! $list->render() !!}
// paginator.blade.php
@if ($paginator->lastPage() > 1)
@foreach ($paginator->getPagesRange() as $page)
{{ $page }}
@endforeach
@endif
// or this
@if ($paginator->lastPage() > 1)
<div class="pagination">
@if($paginator->currentPage()>1)
<a href="{{$paginator->url($paginator->currentPage()-1)}}" class="first"></a>
@else
<a href="javascript:;" class="first-none"></a>
@endif
@foreach ($paginator->getPagesRange() as $page)
@if($paginator->currentPage()==$page)
<span class="current">{{$page}}</span>
@else
<a href="{{$paginator->url($page)}}">{{$page}}</a>
@endif
@endforeach
@if($paginator->currentPage()<$paginator->lastPage())
<a href="{{$paginator->url($paginator->currentPage()+1)}}" class="last last-none"></a>
@else
<a href="javascript:;" class="last-none"></a>
@endif
</div>
@endif
This package is open-sourced software licensed under the MIT license