PHP code example of themismin / laravel-paginate

1. Go to this page and download the library: Download themismin/laravel-paginate 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/ */

    

themismin / laravel-paginate example snippets


// 结果会多出一个自定义数据
$custom = 'xxx';
$list = User::customPaginate($custom = null, $perPage = 15, $columns = ['*'], $pageName = 'page', $page = null);
return $list;

// 结果
{
    "custom": "xxx",
    "data": [
        {
            "name": "x1",
            "date": "xxxx-xx-xx"
        },
        {
            "name": "x2",
            "date": "xxxx-xx-xx"
        }
    ],
    "page_size": 15,
    "current": 1,
    "total": 2
}