PHP Architect · Vol 25, Issue 11 · November 2026
Building Nested Conditional API Resources With Whenloaded
If you've built more than a handful of JSON APIs in Laravel, you've probably hit this problem - your ArticleResource needs to sometimes include the author, sometimes include comments, sometimes include admin-only fields, and never trigger an N+1 query storm while doing any of it.
The full article is in PHP Architect Vol 25, Issue 11. Subscribe to read it and every new issue.