Mon Nov 18
name
isn't a publicly accessible property facepalm.name
is allowed oddly enough but sorting isn't respected so my guess is Laravel can't find the property and tries to sort by the object instead.It's extremely off-putting to see it partially sort and have no fucking clue why it didn't fully sort as expected. I spent longer than I should've and hated myself when I found the answer.
return $categories->sortBy(function(\App\Classes\Uploads\Category $category) {
return $category->getName();
}, SORT_NATURAL);