{{-- One sidebar row that folds several links into a collapsible group (the same .nav-group markup the admin block writes out by hand). $links: [[href, icon, label, badgeHtml?], ...]; nulls are dropped, so callers can write `$cond ? [...] : null`. badgeHtml is trusted markup built by the caller (a count badge), printed unescaped. $id: unique DOM id for the collapse list. $label/$icon (optional): a heading row that only toggles the group. Without them the first link is the heading row and links to its own page. $open (optional): start expanded, e.g. when a hidden link carries a badge. 0 links render nothing; 1 link renders a plain row, so a group never holds a single child. --}} @php $groupLinks = array_values(array_filter($links ?? [])); $groupLabel = $label ?? null; $groupOpen = (bool) ($open ?? false); @endphp @if (count($groupLinks) === 1) @php([$href, $linkIcon, $linkLabel] = $groupLinks[0])
  • {{ $linkLabel }}{!! $groupLinks[0][3] ?? '' !!}
  • @elseif (count($groupLinks) > 1) @php($children = $groupLabel === null ? array_slice($groupLinks, 1) : $groupLinks) @endif