How to use DateTimeInterfaceTransformer? #260
Unanswered
shadowbane
asked this question in
Q&A
Replies: 2 comments 1 reply
-
Hi @shadowbane could you try to put the attributes line after line like: //...
#[MapInputName('datetime_payment')]
#[WithTransformer(DateTimeInterfaceTransformer::class, format: 'Y-m-d H:i:s')]
public Carbon $datetimePayment,
//... |
Beta Was this translation helpful? Give feedback.
1 reply
-
Hi all, You're creating a data object, so a cast should be used like this: #[WithCast(DateTimeInterfaceCast::class, format: 'Y-m-d H:i:s')] |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Greetings, Spatie Team!
I'm trying to create a DTO with the following structure:
With the following data:
But it throws this error:
Is there anything that I did wrong? I've tried
dd()
ingSpatie\LaravelData\Transformers\DateTimeInterfaceTransformer@transform
but it never calledBeta Was this translation helpful? Give feedback.
All reactions