Laravel API Resources: whenLoaded() To Avoid N+1 Queries

I want to show why and when you should use $this-whenLoaded() in the code of Eloquent API Resource.

Original Tweet:
My course “GraphQL in Laravel From Scratch”:

– – – – –
Support the channel by checking out my products:
– My Laravel courses:
– Laravel QuickAdminPanel:
– Livewire Kit Components:

– – – – –
Other places to follow:
– My weekly Laravel newsletter:
– My personal Twitter:


Leave a Reply

Your email address will not be published. Required fields are marked *