Dto with form request in the same class in PATCH with optional fields #634
Unanswered
OthmanAlseagh
asked this question in
Q&A
Replies: 1 comment
-
That's because you overwrite the rule in the rules method, Data won't make up rules automatically when you do that. Add #[max(255)] as an attribute to title and it should work. |
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
-
i have this dto
class UpdateArticleData extends Data
{
use HasFailedValidationDtoRequest;
}
it acts as form request and in the same time dto
in my case, i have patch method and the title is optional in update, but in the same time it is not nullble in database
so the optional should remove it from the dto but the validation catch it
when i use nallable in validation the database throw exception
i don't want to handle it in code, is there a way i can handle it in the same dto ???
Beta Was this translation helpful? Give feedback.
All reactions