Group resource list without model ID
I'm trying to create a page that will bring the records of Student Certificates from the group grouped by Id_student, where I will have a second screen later on that will list the certificates of a specific student selected, but in this case, when I do the Group By, it will return this to me. error "SQLSTATE[42000]: Syntax error or access violation: 1055 'dash_unidesco.mc_certificado_aluno.id_aluno_certificado' isn't in GROUP BY", how can I do this group by?
In model "CertificadoAluno" the id would be id_certificado_aluno
in Group By I am using another field
class CertificadoAlunoResource extends Resource
{
protected static ?string $model = CertificadoAluno::class;
protected static ?string $navigationIcon = 'heroicon-o-collection';
protected static ?string $navigationGroup = 'Micro Certificado';
protected static ?string $navigationLabel = 'Certificado Alunos';
protected static ?string $label = 'Controle de Certificado Alunos';
public static function getEloquentQuery(): Builder
{
return parent::getEloquentQuery()->select('*')->groupBY('id_aluno');
}
...
}
If you need more information, just ask
0 Replies