Skip to content
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
@simplenotezy

Description

@simplenotezy

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions