Skip to content

Commit

Permalink
Sort the tags by name before returning (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
king724 authored and freekmurze committed Aug 6, 2019
1 parent a849ba0 commit b4cf9c3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Http/Controllers/TagsFieldController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ public function index(Request $request)
$query->limit($request['limit']);
}

return $query->get()->map(function (Tag $tag) {
$sorted = $query->get()->sortBy(function (Tag $tag) {
return strtolower($tag->name);
})->values();

return $sorted->map(function (Tag $tag) {
return $tag->name;
});
}
Expand Down

0 comments on commit b4cf9c3

Please sign in to comment.