Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/krossroad/laravel-unionpaginator
Support pagination for union queries for Laravel Eloquent
https://github.com/krossroad/laravel-unionpaginator
laravel laravel-5-package laravel-eloquent laravel-paginator laravel-union-paginator laravel5 pagination
Last synced: 3 months ago
JSON representation
Support pagination for union queries for Laravel Eloquent
- Host: GitHub
- URL: https://github.com/krossroad/laravel-unionpaginator
- Owner: krossroad
- License: mit
- Created: 2017-09-23T16:39:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-02-20T05:14:30.000Z (almost 2 years ago)
- Last Synced: 2024-09-28T19:03:31.859Z (3 months ago)
- Topics: laravel, laravel-5-package, laravel-eloquent, laravel-paginator, laravel-union-paginator, laravel5, pagination
- Language: PHP
- Size: 15.6 KB
- Stars: 19
- Watchers: 2
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Laravel Union Paginator
[![Latest Stable Version](https://poser.pugx.org/krossroad/laravel-union-paginator/v/stable)](https://packagist.org/packages/krossroad/laravel-union-paginator) [![Total Downloads](https://poser.pugx.org/krossroad/laravel-union-paginator/downloads)](https://packagist.org/packages/krossroad/laravel-union-paginator) [![License](https://poser.pugx.org/krossroad/laravel-union-paginator/license)](https://packagist.org/packages/krossroad/laravel-union-paginator)
## Note
Laravel supports union pagination from [v5.7](https://github.com/laravel/framework/pull/26466)## Installation
For Laravel v5.5 to v5.7
```
composer require 'krossroad/laravel-union-paginator:5.5'
```For Laravel v5.2 to v5.4
```
composer require 'krossroad/laravel-union-paginator:5.4'
```### Usage
> Just use `UnionPaginatorTrait` in your model and you are good to go.
#### Example Model
```php
`->unionPaginate()` --> returns \Illuminate\Pagination\LengthAwarePaginator instance```php
$first = User::whereNull('first_name');$pagination = User::whereNull('last_name')
->union($first)
->unionPaginate(
$perPage,
$columns,
$pageName = 'page',
$page
);
```If you find any bug, issue or have queries. Please [create a new issue](https://github.com/krossroad/laravel-unionpaginator/issues/new)