paginate返回的数据,在API中并不适用,比如first_page_url这种,如何把这个过滤掉?

{
        "current_page": 2,
        "data": [
            {
                "store_group_id": 2,
                "channel": {
                    "id": 2,
                    "channel_name": "石家庄金平区"
                }
            },
            {
                "store_group_id": 2,
                "channel": {
                    "id": 2,
                    "channel_name": "石家庄金平区"
                }
            }
        ],
        "first_page_url": "http://pinkr.work/Crm/Store/GetStoresByChannel?page=1",
        "from": 3,
        "last_page": 3,
        "last_page_url": "http://pinkr.work/Crm/Store/GetStoresByChannel?page=3",
        "next_page_url": "http://pinkr.work/Crm/Store/GetStoresByChannel?page=3",
        "path": "http://pinkr.work/Crm/Store/GetStoresByChannel",
        "per_page": "2",
        "prev_page_url": "http://pinkr.work/Crm/Store/GetStoresByChannel?page=1",
        "to": 4,
        "total": 5
    }

这里面中的first_page_urllast_page_urlnext_page_urlprev_page_urlpath 并不需要,怎样把这些字段过滤掉?

JellyBool

自己remove 或者 unset 呗。或者你针对 Pagination 写一个 Transformer

Nixus 回复 JellyBool

噢,看来我写了一个function处理,不算low?

xiaowuya123

既然是API 不应该直接用limit offset来分页么…

Nixus 回复 xiaowuya123

为什么要用limit offset呢?感觉pagination挺好的呀