Skip to content

Conversation

YannikFirre
Copy link
Contributor

Hello,

I have added nested resources when use resource:api.

What do you think about it?

Good day,

Yannik

@jasonmccreary
Copy link
Collaborator

I'm not sure what it is. I also would have assumed Laravel automatically used resources for related models.

@YannikFirre
Copy link
Contributor Author

Currently the resource file is only generated with the data of the model and without its relations if these were loaded.

This addition allows that if they are loaded they are returned when using the resource.

Reference to this: https://laravel.com/docs/8.x/eloquent-resources#relationships

@jasonmccreary jasonmccreary merged commit 4c2873f into laravel-shift:master Aug 13, 2021
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.

2 participants