Skip to content

Conversation

@stevebauman
Copy link
Member

@stevebauman stevebauman commented Sep 9, 2025

I quickly discovered that the previous method of anonymizing JsonResource's doesn't work with nested resources, because Laravel calls toArray on nested resources and not resolve():

https://github.com/laravel/framework/blob/a46b55100bb7ac0b7f7e782f67a21e686608ce45/src/Illuminate/Http/Resources/Json/ResourceCollection.php#L93-L102

This means anonymization has to be opted-into manually in the toArray method to be properly effective across all resources (nested or otherwise).

@stevebauman stevebauman merged commit 78f744e into master Sep 9, 2025
4 checks passed
@stevebauman
Copy link
Member Author

Going to merge this in to fix asap before potential of breaking changes.

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