Replies: 3 comments 4 replies
-
Hi @quyle92 I think that is not theoretical dto, we talking about dto with the context and data from the model! so the default values should come from the model himself. https://laravel.com/docs/9.x/eloquent#default-attribute-values in MVC aspects you don't want more than one source to get the values. |
Beta Was this translation helpful? Give feedback.
-
Hi @quyle92 Can you add please the imputation of the getData method? Thanks for your explanation! 👍 |
Beta Was this translation helpful? Give feedback.
-
What's the value of |
Beta Was this translation helpful? Give feedback.
-
Hi,
I have this DTO class with nested collection of
Decklist
:I am trying to convert current model instance to a data object by using WithData trait:
but when using
getData()
method, I cannot get default values defined inDecklist
class, i.e calling$character_class->getData()
only returns empty array.But I want it to return default values of defined in
Decklist
class like so:How can I achieve this please?
Beta Was this translation helpful? Give feedback.
All reactions