Category: Laravel, api

Laravel API resources are a great tool to format json resources to be returned by an API endpoint. If you are not familiar with this part of the framework, the Laravel documentation will help you.

Now the purpose of this post is not to introduce you to this particular problem, and you’ll find great resources and packages to help you with this.

Yes, this trick is great for single resources (tipically in the show() method of our controller), but this will not work when calling `ProjectResource::collection(…

I hope this will help you to fix some resources; I’m using this code, or a variation of this, in my current projects, at Code 16.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners