Comments (2)
I'm pretty confident this is due to way transform()
is called in \Spatie\LaravelData\Concerns\TransformableData::toJson()
.
The default value for \Spatie\LaravelData\Concerns\BaseDataCollectable::transform(wrapExecutionType)
is \Spatie\LaravelData\Support\Wrapping\WrapExecutionType::Disabled
and the method is only called with \Spatie\LaravelData\Support\Wrapping\WrapExecutionType::Enabled
in \Spatie\LaravelData\Concerns\ResponsableData::toResponse()
The documentation is unclear if this is expected behavior, but I don't think that it should be.
from laravel-data.
Please read the docs on this: https://spatie.be/docs/laravel-data/v3/as-a-resource/wrapping
Data objects will only get wrapped when you're sending them as a response and never when calling toArray or toJson on it.
This is expected behavior, I've added a small section on how it can be enabled.
from laravel-data.
Related Issues (20)
- Array type is not cast or checked HOT 4
- Dot notation doesn't work with related model's property with MapInputName HOT 2
- Nested backed enum throwing error (must be of type Enum, string given)
- Relation with recursive reference causes infinite loop (even if it's not in the data) HOT 1
- Unable to transform data HOT 1
- Eager loaded relations are reset which throws a lazy loading violation HOT 1
- "Unique" validator with ignore parameter works wrong in sequentially run tests HOT 1
- Package does not support a `fromNull(null $null): null` handler HOT 1
- No documentation on spatie website for encrypted eloquent casting HOT 1
- #[List] validation attribute not working - syntax error, unexpected token "list" HOT 1
- ::from(...) Wrong error message when there's attribute name issue in a nested class HOT 1
- Empty arrays aren't converted to Collections HOT 2
- Lazy::whenLoaded has not any method that indicate is relation loaded or not? HOT 1
- Abstract data objects not encrypted HOT 1
- When using app() Container method with partial $model->fill() data, validation failes HOT 2
- If extends is Dto, not Data, DataVarDumperCaster error occurs HOT 2
- Livewire Synths not working in data object contains an array HOT 3
- Possible break in 4.8.0 HOT 1
- Conflict Between Optional and Required Rules
- ->include doesn't work if the property is nullable
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-data.