What I’d suggest:
Right after this loop and before anything else:
<?php foreach ($article->images() as $image) : ?>
<?php $loading = ($image === $article->images()->first()) ? 'eager' : 'lazy'; ?>
Then instead of
loading="<?= $loading ?>"
What I’d suggest:
Right after this loop and before anything else:
<?php foreach ($article->images() as $image) : ?>
<?php $loading = ($image === $article->images()->first()) ? 'eager' : 'lazy'; ?>
Then instead of
loading="<?= $loading ?>"