Replies: 1 comment
-
Did you try passing the model as a first parameter and the request as a second while creating data object? SongData::from($song, $request); Then, the package will merge the missing fields from the request. This is maybe a workaround, but it should work. I don't know if maintainers can propose us a better solution to this problem? |
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
-
How do y'all handle your
PATCH
requests with nullable fields?What I mean:
In
PATCH
conventionally, these requests should behave differently:title
andartist
to null.artist
to null and leavetitle
as-is.With standard Laravel FormRequests, it is pretty easy: just do
$model->update($validated)
But with DTOs this wouldn't work:
Beta Was this translation helpful? Give feedback.
All reactions