Rox
Rox

Reputation: 361

accessing array inside array php laravel

I have an array $data['result'] ,and I can access it by $data['result'] , I want to access the array inside the result array called items and then again the items array inside that items array. Please help. snapshot

Upvotes: 0

Views: 1961

Answers (1)

patricus
patricus

Reputation: 62248

$data['result'] is a LengthAwarePaginator.

The first items child is a Collection representing the slice of data being paginated.

The items in the Collection is the array of items represented by the Collection.

You can access this array from the paginator using the items() method.

$collectionItems = $data['result']->items();

Upvotes: 1

Related Questions