Laravel devs, streamline your API responses with this gem! 💎
Use JsonResource::withoutWrapping() to remove the outer 'data' key from resource responses. Perfect for customizing API structures or matching specific client expectations.
Pro tip: Apply globally in a service provider for consistency.
www.harrisrafto.eu/streamlining-laravel-api-responses-disabling-resource-wrapping #Laravel
•
In response to @harris_rafto
I personally like and use data wrapper but I see why people mostly get rid of it.
•
In response to @ozdemiru
I also use the data wrapper, it makes the result more predictable.