Laravel Media Library: Load Only 1st Picture Efficiently
– naxon.dev - submitted by Daniel Naxon
I needed to display only the first picture from my Product's model media collection and found my app running five queries and hydrating 16 models with only four products to display 😱 . Here's how I ended with only two queries and eight models.
Read more [naxon.dev]