The largest feature to come to Laravel 5.5 is the API resources. This feature allows you to manage your JSON payloads for your API much easier. For those of you maintaining APIs in Laravel, you will begin to jump for joy with how easy this has become.
Think of API resources like templates for your JSON payloads. In the past, previous versions of Laravel would run a simple json_encode on your model objects to return a JSON request. This meant you were outputing a direct mapping of your database (minus any hidden fields you defined). This is bare bones functionality and generally is ok for internal APIs but much more control is required for Public APIs.
Thanks to API resources we now have an easy way to control the layout of our JSON payloads by creating a "resource" and defining the structure in the resource. I like to think of resources as "JSON templates". With these templates we can define the information we want in the resource and even create or combine information from multiple models or nested relationships.
The video explains all of this in more detail than I can explain here, so be sure to check it out.
==== LINKS ====
Documentation on API Resources
laravel.com/docs/5.5/eloquent-resources
==== MORE FROM THIS SERIES . ====
Full Playlist for the “Laravel 5.5 New Features“ Series:
ru-vid.com/group/PLwAKR305CRO8GY3HVpXShlrXab8Cd7VT_
==== FOLLOW ME ====
Subscribe for New Releases!
Subscribe to DevMarketer Insider
[Email Newsletter]
confirmsubscription.com/h/d/5EDC91CF554832D1
Twitter - _jacurtis
(ask me questions!)
==== QUESTIONS? ====
Leave a comment below and I or someone else can help you.
For quick questions you may also want to ask me on Twitter, I respond almost immediately.
Email me hello@jacurtis.com
Thanks for all your support!
24 сен 2017