indexOf() but sorted

Hey: I’m building a slider with a counter.
But the images are manually sorted and filtered with ->sortBy('sort')
Now if I use ->indexOf() I get the index of where an item is placed in the alphamumeric order.
How can I resolve this?

<?php $filtered = $page->images()->filterBy('skip', false) ?>
<?php $amount = $filtered->count() ?>
<?php $items = $filtered->sortBy('sort') ?> 
<?php foreach($items as $item): ?>

	<p class="counter"><?= $item->indexOf() + 1 ?>/<?= $amount ?></p>

<?php endforeach ?>

You have to pass the collection as argument

 $item->indexOf($items)
1 Like

Is there anywhere beer donation button for you guys? I’m so happy having such a great support.

5 Likes