我有一个带有键的值数组(例如0、1,2等)。我需要对它进行分页,结果不带键就可以收集这些值。
一开始我就有这样的数组
array:11 [
0 => {#829
+"id": 2417
+"date": "2019-12-24 15:05:04"
+"eventName": "Atlas"
+"gift_type": null
+"count": 2
}
1 => {#872
+"id": 2409
+"date": "2019-08-22 19:00:00"
+"eventName": "ДАХАБРАХА. ЗЕМЛЯ"
+"gift_type": "to"
+"count": 4
}
]
在分页之后,我需要得到它,然后在第一页上得到它:
{
"current_page": 1,
"data": [
{
"id": 2417,
"date": "2019-12-24 15:05:04",
"eventName": "Atlas",
"gift_type": null,
"count": 2
},
{
"id": 2409,
"date": "2019-08-22 19:00:00",
"eventName": "ДАХАБРАХА. ЗЕМЛЯ",
"gift_type": "to",
"count": 4
}
],
"first_page_url": "http://ticketsale/ajax/orders/77?page=1",
"from": 1,
"last_page": 4,
"last_page_url": "http://ticketsale/ajax/orders/77?page=4",
"next_page_url": "http://ticketsale/ajax/orders/77?page=2",
"path": "http://ticketsale/ajax/orders/77",
"per_page": 3,
"prev_page_url": null,
"to": 3,
"total": 11
}
但是在第二页上,我使用WITH键值:
{
"current_page": 2,
"data": {
"3": {
"id": 2404,
"date": "2019-08-22 19:00:00",
"eventName": "ДАХАБРАХА. ЗЕМЛЯ",
"gift_type": "to",
"count": 3
},
"4": {
"id": 2400,
"date": "2019-08-22 19:00:00",
"eventName": "ДАХАБРАХА. ЗЕМЛЯ",
"gift_type": "to",
"count": 1
}
},
"first_page_url": "http://ticketsale/ajax/orders/77?page=1",
"from": 4,
"last_page": 4,