Repository navigation
Replies: 1 comment
|
This is expected with the current API. To remove the property from the transformed output, use the general partial-selection method $data = ExampleData::from($model)
->except("property")
->toArray();If the removal itself is conditional, use $data->exceptWhen("property", $shouldExclude);The distinction can also be seen in |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
According to documentation, it isn’t possible to include the property later on with the include method when a condition isn’t accepted.
https://spatie.be/docs/laravel-data/v4/as-a-resource/lazy-properties#content-conditional-lazy-properties
However, I’m trying to exclude the property. Is it a bug or expected behavior?
Why's not it possible to exclude a lazy property even if it's conditional?
All reactions