Folks, I want to sort following nested collection
by string alphabeticaly:
$collection = collect([
["name"=>"maroon"],
["name"=>"zoo"],
["name"=>"ábel"],
["name"=>"élof"]
])->sortBy("name");
I would expect:
1=> "ábel"
2=> "élof"
3=> "maroon"
4=> "zoo"
I got instead:
1=> "maroon"
2=> "zoo"
3=> "ábel"
4=> "élof"
I seen some PHP threads for this, but I am curious if there is any Laravel workaround for this. Thanks.
strtolower
on the property you are sorting by – Neurath