2
I need to sort an array by a specific "order" field, where within that array I have banners objects with the id, order, name and img fields. I need to sort this array in order. the order banner 0 needs to come in first, 1 in second and so on.
2
I need to sort an array by a specific "order" field, where within that array I have banners objects with the id, order, name and img fields. I need to sort this array in order. the order banner 0 needs to come in first, 1 in second and so on.
2
You can use the sortBy method of a Collection, for this, create a Collection object from the array and sort:
$collection = collect($array)->sortBy('ordem');
I hope it helps.
Browser other questions tagged php laravel laravel-5 classification
You are not signed in. Login or sign up in order to post.
Have example of this array? If yes put the question.
– novic