Remove lazy loading from first image in loop

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 ?>"