In Laravel 5.5, resource classes allow you to transform your Eloquent models into the proper JSON data structure. Though you can of course override the
toArray() method on your models to allow for this, when building an API that you intend to expose to potentially millions of users, it's important to codify this structure and response format as reliably and consistently as you can.
Published on Aug 30th, 2017.
Understand.io is used by hundreds of Laravel developers to find and fix errors.
Sign up for a free 14-day trial now.