-
Hello, the company I work at has adopted spatie/data and are building quite a lot of functionality using it, but I have a basic question. I find it very surprising the There's not even an example in the validation documentation on how you suggest to validate payloads. Seems a lot of needless lines if we have to MyDto::validate($payload);
$dto = MyDto::from($payload); what is the proper way and is there a single statement to validate and get an instance? |
Beta Was this translation helpful? Give feedback.
Answered by
raveren
Mar 21, 2023
Replies: 1 comment
-
SongData::validateAndCreate(['title' => 'Never gonna give you up', 'artist' => 'Rick Astley']); |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
raveren
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://spatie.be/docs/laravel-data/v3/as-a-data-transfer-object/request-to-data-object#content-validating-a-data-object-without-request