Fixed groups order on API

Issue: if the request use “?sort=order” returns groups ordered by “order DESC”.

This is unexpected.
If I would a reversed order I have to use “sort=order&order=desc”
This commit is contained in:
Davide Bellini 2016-10-05 09:26:52 +02:00
parent 37efa3690d
commit 7cdd537b42

View File

@ -62,7 +62,7 @@ class ComponentGroupController extends AbstractApiController
$groups->search(Binput::except(['sort', 'order', 'per_page']));
if ($sortBy = Binput::get('sort')) {
$direction = Binput::has('order') && Binput::get('order') == 'desc';
$direction = Binput::get('order', 'asc');
$groups->sort($sortBy, $direction);
}