Wednesday, March 8, 2017

Order collection of array objects

After making some queryes i have a collection of array objects. But after orderByDesc the data transform in hole objects, instead of how it was (array of objects), what it happened? Is like the method orderByDesc tranform the collection in another type.

Ex: some logic code, queries...etc in the end

return $total->sortByDesc('date');

After using sortByDesc:

enter image description here

Before to sortByDesc: enter image description here

Now that is in type of objects is giving some issues working with it in my javascript application (angularjs), it not a array of objects how should it be.



via Pedro

Advertisement