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: https://twitter.com/mmartin_joo/status/1611017282217443330
My course “GraphQL in Laravel From Scratch”: https://laraveldaily.com/course/graphql-laravel?mtm_campaign=20230131-youtube-whenloaded

– – – – –
Support the channel by checking out my products:
– My Laravel courses: https://laraveldaily.com/courses?mtm_campaign=20230131-youtube-whenloaded
– Laravel QuickAdminPanel: https://quickadminpanel.com
– Livewire Kit Components: https://livewirekit.com

– – – – –
Other places to follow:
– My weekly Laravel newsletter: https://us11.campaign-archive.com/home/?u=a459401212599a54203d036ee&id=91c1337873
– My personal Twitter: https://twitter.com/povilaskorop

Source: https://www.youtube.com/watch?v=Ls7m14eCaSU

Leave a Reply

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