PHP code example of krossroad / laravel-union-paginator

1. Go to this page and download the library: Download krossroad/laravel-union-paginator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

krossroad / laravel-union-paginator example snippets



/**
 * @filename {project}/App/Models/User.php
 */

namespace \App\Models\User;

use Krossroad\UnionPaginator\UnionPaginatorTrait;

class User extends Model
{
    use UnionPaginatorTrait;
    ...
}


$first = User::whereNull('first_name');

$pagination = User::whereNull('last_name')
    ->union($first)
    ->unionPaginate(
        $perPage,
        $columns,
        $pageName = 'page',
        $page
    );