ozza's avatar
Level 3

Accessing property of a collection

hello,

i have a collection which has a dd() like;

Pagination {#264 ▼
  #total: 2324665
  #lastPage: 232467
  #items: Collection {#262 ▼
    #items: array:10 [▶]
    +"total": 2324665
    +"max_score": null
    +"took": 70
    +"timed_out": false
    +"scroll_id": "DnF1ZXJ5VGh◀"
    +"shards": {#263 ▶}
  }
  #perPage: 10
  #currentPage: 1
  #path: "http://127.0.0.1:8000/scr"
  #query: []
  #fragment: null
  #pageName: "page"
}

but returning the collection just gives me the array;

{
"current_page": 1,
"data": [],
"first_page_url": "http://127.0.0.1:8000/scr?page=1",
"from": 1,
"last_page": 232488,
"last_page_url": "http://127.0.0.1:8000/scr?page=232488",
"next_page_url": "http://127.0.0.1:8000/scr?page=2",
"path": "http://127.0.0.1:8000/scr",
"per_page": 10,
"prev_page_url": null,
"to": 10,
"total": 2324880
}

i need to get the "scroll_id" but i can't manage to. $collection->scroll_id returns an undefined property error. can someone help me?

0 likes
3 replies

Please or to participate in this conversation.