просто измените библиотеку: Jenssegers \ Mongodb \ Relations \ EmbedsMany.php
добавьте $sliced = $this->toCollection($sliced);
в строку 294 (перед возвратом) в методе paginate()
, теперь вы можете получить такой результат:
{
"current_page": 2,
"data": [
{
"lat": 59.56555555455,
"lon": 35.54598994564,
"type": "system",
"updated_at": "2018-10-28 08:12:36",
"created_at": "2018-10-28 08:12:36",
"_id": "5bd56f746925020c34006778"
},
{
"lat": 59.56555555455,
"lon": 35.54598994564,
"type": "manual",
"updated_at": "2018-10-28 08:13:55",
"created_at": "2018-10-28 08:13:55",
"_id": "5bd56fc36925020c34006779"
},
{
"lat": 59.56555555455,
"lon": 35.54598994567,
"type": "system",
"updated_at": "2018-10-28 08:13:55",
"created_at": "2018-10-28 08:13:55",
"_id": "5bd56fc36925020c3400677a"
},
{
"lat": 59.56555555455,
"lon": 35.54598994564,
"type": "system",
"updated_at": "2018-10-28 08:13:55",
"created_at": "2018-10-28 08:13:55",
"_id": "5bd56fc36925020c3400677b"
},
{
"lat": 59.56555555455,
"lon": 35.54598994564,
"type": "manual",
"updated_at": "2018-10-28 10:39:46",
"created_at": "2018-10-28 10:39:46",
"_id": "5bd591f26925020c3400677d"
}
],
"first_page_url": "**********traffic/list?page=1",
"from": 6,
"last_page": 3,
"last_page_url": "**********traffic/list?page=3",
"next_page_url": "**********traffic/list?page=3",
"path": "**********traffic/list",
"per_page": "5",
"prev_page_url": "**********traffic/list?page=1",
"to": 10,
"total": 12
}