Building Nested Conditional API Resources With Whenloaded
By Eric Van Johnson
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. by Eric Van Johnson
This article was originally published in the November 2026 issue of php[architect] magazine. To read the complete article please subscribe or purchase the complete issue.
![php[architect] logo](/wp-content/themes/phpa/images/new_logo_mark_nav.png)


Leave a comment
Use the form below to leave a comment: