Skip to content

Attempt to match the Response to the ticket spec#1205

Open
tarrow wants to merge 12 commits into
mainfrom
tarrow-ideas-T429591
Open

Attempt to match the Response to the ticket spec#1205
tarrow wants to merge 12 commits into
mainfrom
tarrow-ideas-T429591

Conversation

@tarrow

@tarrow tarrow commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

I attempted to do this by:

  • adapting the Collection to not be wrapped in a data object[0]
  • adding the items key to the structure of the ResourceCollection[1]
  • creating a Resource for the structure to represent each Policy as it looks on the wire[2]
  • mapping the existing Collection to use the new PolicyResource

I was led in this direction by a blog[3] and stackoverflow[4]

[0] https://api.laravel.com/docs/11.x/Illuminate/Http/Resources/Json/JsonResource.html#method_wrap
[1] https://laravel.com/docs/11.x/eloquent-resources#resource-collections
[2] https://laravel.com/docs/11.x/eloquent-resources#introduction
[3] https://dev.to/programmerhasan/how-to-use-laravels-api-resource-collections-for-efficient-data-handling-143g
[4] https://stackoverflow.com/a/67852854

@tarrow tarrow marked this pull request as ready for review July 16, 2026 07:47
@deer-wmde

Copy link
Copy Markdown
Contributor

thanks for providing this example, I adapted it in #1198

Base automatically changed from T429591 to main July 16, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants