Merge pull request #1121 from mailpoet/template_sort
Applies sorting by date created and name [MAILPOET-1119]
This commit is contained in:
@ -29,7 +29,7 @@ class NewsletterTemplates extends APIEndpoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getAll() {
|
function getAll() {
|
||||||
$collection = NewsletterTemplate::findMany();
|
$collection = NewsletterTemplate::orderByDesc('created_at')->orderByAsc('name')->findMany();
|
||||||
$templates = array_map(function($item) {
|
$templates = array_map(function($item) {
|
||||||
return $item->asArray();
|
return $item->asArray();
|
||||||
}, $collection);
|
}, $collection);
|
||||||
|
Reference in New Issue
Block a user