This repository was archived by the owner on Jul 16, 2023. It is now read-only.
This repository was archived by the owner on Jul 16, 2023. It is now read-only.
Only validate changed fields #273
Open
Description
Say I have a user model like this:
class User {
public static $rules = [
'email' => 'sometimes|required|unique:users,email|email',
'firstname' => 'sometimes|required|min:1',
'lastname' => 'sometimes|required|min:1',
];
}
The user is already saved in database, but without e-mail, firstname, or lastname.
The user wish to update ONLY his e-mail. When he sends the request, only containing an e-mail field, the validation will fail, because he did not provide an firstname and lastname.
How can I avoid that? I.e. only validate the fields that are sent in the request; so if firstname is not sent, Ardent will not validate it, and instead only validate the fields that are present.
Metadata
Metadata
Assignees
Labels
No labels