Magento, Laravel, Eloquent.
N being the number of products. Laravel offers a simple way to fix this issue using eager loading. Eager loading means that we want to retrieve all the related models before using them. Under the hood, Laragento will make only one SQL query to retrieve every related brand. So instead of making N+1