fix: [CRUDComponent] Full group by on meta-templates

pull/40/head
mokaddem 2021-02-24 11:10:10 +01:00
parent a8951ed69e
commit de4ba80e21
1 changed files with 2 additions and 1 deletions

View File

@ -252,7 +252,8 @@ class CRUDComponent extends Component
$query->innerJoinWith('MetaTemplateFields', function ($q) {
return $q->contain('MetaFields')->innerJoinWith('MetaFields');
});
$query->group(['MetaTemplates.id'])->order(['MetaTemplates.is_default' => 'DESC']);
$query->group(['MetaTemplates.id', 'MetaTemplates.scope', 'MetaTemplates.name', 'MetaTemplates.namespace', 'MetaTemplates.description', 'MetaTemplates.version', 'MetaTemplates.uuid', 'MetaTemplates.source', 'MetaTemplates.enabled', 'MetaTemplates.is_default'])
->order(['MetaTemplates.is_default' => 'DESC']);
$metaTemplates = $query->all();
$data['metaTemplates'] = $metaTemplates;
return $data;