I have one table who has this values:
unidade_id, bloco_id, image_name and version.
To shrink my index view, I'm trying to show only the last version of image_name. But the problem is... when I groupBy and orderBy this values, the result is always the first version.
Here is my controller:
$image_list = Imagem::orderBy('version', 'desc')
->groupBy(['unidade_id', 'bloco_id', 'image_name'])
->get();
My DB has this example values:
image_name: Windows10_SalaDeAula | version: 3.0
image_name: Windows10_SalaDeAula | version: 4.0
The result in my index is always the 3.0 version, but I need to show the last version only.
what I'm doing wrong?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire