@foreach($allGroups as $g)
@php $group = $pretty($g)->value(); @endphp
@endforeach
@foreach($sorted as $it)
@php
$img = $it['image'] ?? '';
$href = $img; // no separate link in your data; use the image itself
$alt = $it['title'] ?? '';
$groups = $parseGroups($it['groups'] ?? null);
if (empty($groups)) { $groups = ['uncategorized']; }
$dataGroups = json_encode(array_values($groups));
@endphp