API Resources

Episode 20
Run Time 11:24

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.