Fixes API sorting and filtering. Closes #1489
This commit is contained in:
committed by
James Brooks
parent
98550c31c9
commit
919c7127e7
@@ -37,7 +37,15 @@ class ComponentController extends AbstractApiController
|
||||
$components = Component::enabled();
|
||||
}
|
||||
|
||||
return $this->paginator($components->paginate(Binput::get('per_page', 20)), Request::instance());
|
||||
if ($sortBy = Binput::get('sort')) {
|
||||
$direction = Binput::has('order') && Binput::get('order') == 'desc';
|
||||
|
||||
$components->sort($sortBy, $direction);
|
||||
}
|
||||
|
||||
$components = $components->paginate(Binput::get('per_page', 20));
|
||||
|
||||
return $this->paginator($components, Request::instance());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user