Merge pull request #1121 from mailpoet/template_sort

Applies sorting by date created and name [MAILPOET-1119]
This commit is contained in:
amine-mp
2017-09-27 11:14:00 +02:00
committed by GitHub

View File

@ -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);