How Do You Use Laravel Data with Spatie Media? #1003
Unanswered
rizaldywirawan
asked this question in
Q&A
Replies: 0 comments
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.
-
TL;DR
Currently, I start use Laravel Data, and sometimes confuse to draw border to treat a DTO as a converter from user input to action class, and when to use them as a resource to show data.
I have this model called Pet, where every pet will have 0 to many photos.
I create 2 DTO for it, for new pet and update pet.
The problem is when we want to include the photo to the data.
Should we create a MediaData (and what should we put inside the property?) and then composite it inside the CreatePetData and UpdatePetData? We have 2 data because different column input when creating and updating.
Sometimes i thought to use the UpdatePetData as resource too, not only DTO, so it will fill the form through the DTO.
Please let me know your thought.
Thank you
Beta Was this translation helpful? Give feedback.
All reactions