Loop of 4 tags lists in a menu

Hello,

I use 4 types of Tags on my site (www.oliviergassies.fr) using a controller. In the snippet menu, I would like to automatically call these 4 types of tags with a loop to display their name and display their respective content.
Currently I do it manually four times :

  <div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
    <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="false" aria-controls="collapseTwo">
      Type
    </a>
</div>
<div id="collapseOne" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne">
  <ul class="list-group">
    <li class="list-group-item"><a href="<?php echo page('works')->url() ?>">Tout</a></li>
    <?php $types = page('works')->children()->visible()->pluck('types', ',', true); ?>
    <?php foreach($types as $type): ?>
    <li class="list-group-item"><a href="<?php echo url('works/' . url::paramsToString(['type' => $type])) ?>"><?php echo html($type) ?></a></li>
    <?php endforeach ?>
  </ul>
</div>
  </div>

  <div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingTwo">
    <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
      Séries
    </a>
</div>
<div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
  <ul class="list-group">
    <li class="list-group-item"><a class="" href="<?php echo page('works')->url() ?>">Tout</a></li>
    <?php $series = page('works')->children()->visible()->pluck('series', ',', true); ?>
    <?php foreach($series as $serie): ?>
    <li class="list-group-item"><a class="" href="<?php echo url('works/' . url::paramsToString(['serie' => $serie])) ?>"><?php echo html($serie) ?></a></li>
    <?php endforeach ?>
  </ul>
</div>
  </div>

  <div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingThree">
    <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
      Éditions
    </a>
</div>
<div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
  <ul class="list-group">
    <li class="list-group-item"><a class="" href="<?php echo page('works')->url() ?>">Tout</a></li>
    <?php $editors = page('works')->children()->visible()->pluck('editors', ',', true); ?>
    <?php foreach($editors as $editor): ?>
    <li class="list-group-item"><a class="" href="<?php echo url('works/' . url::paramsToString(['editor' => $editor])) ?>">
    <?php echo html($editor) ?>
    </a></li>
    <?php endforeach ?>
  </ul>
</div>
  </div>

  <div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingFour">
    <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseFour" aria-expanded="false" aria-controls="collapseFour">
      Années
    </a>
</div>
<div id="collapseFour" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingFour">
  <ul class="list-group">
    <li class="list-group-item"><a class="" href="<?php echo page('works')->url() ?>">Tout</a></li>
    <?php $years = page('works')->children()->visible()->pluck('years', ',', true); ?>
    <?php foreach($years as $year): ?>
    <li class="list-group-item"><a class="" href="<?php echo url('works/' . url::paramsToString(['year' => $year])) ?>"><?php echo html($year) ?></a></li>
    <?php endforeach ?>
  </ul>
</div>
  </div>

Is there a solution?
thanks in advance

You could create an array with all values

$allStuff = [
  'series' => page('works')->children()->visible()->pluck('series', ',', true),
  'editors' => // ...
];

Then loop through this array.

Thank you,
I m gone a try this,
This i new for me
Best

You will then basically need two loops, one for the outer tag type, and one for the inner li elements.