Custom Grouping Order

Ok, I see, seems to depend on the order. Other idea (condition1etc. is just a placeholder for your conditions:

We map an order number to each item depending on condition and then sort by this order number.

$groups = $site->find('events','exhibitions')->children()->visible()->map(function($article) {
if(condition1) $article->order = 1;
else if(condition2))   $article->order = 2;
else if(condition3)) $article->order = 3;
else $article->order = 4;
return $article;
})->sortBy('order');

$groups = $groups->group(function($item) {
  return $item->order();
});
dump($groups);
// then as before using the mapping array

The resulting groups should now come out in the desired order provided that you apply your order numbers according to your sorting scheme.

Another option is to take your wrongly sorted groups from above, convert to an array, sort by key and convert back to collection:

$groups = $groups->toArray();
ksort($groups);
$groups = new Collection($groups);
dump($groups);