Skip to content

Latest commit

 

History

History
9 lines (7 loc) · 587 Bytes

api.md

File metadata and controls

9 lines (7 loc) · 587 Bytes

Resources and Transformer

The Laravel way of building API is to use a resource object. The framework provides a lot of the functionality needed out of the box and it is extremely easy to use.

I use resources for almost all my models, apart from Fixture. For those I use a transformer. I just wanted to show a different way of doing things. I would have preferred using this method for another model, one that does not need pagination, e.g. Season, because the ResourceCollection class provides it by default, while by using a transformer I will have to implement it myself.