Skip to content

Doble validation on "unique:" validation #79

@amendozaaguiar

Description

@amendozaaguiar

Laravel Rest Api Version

^2.3

Laravel Version

^10.10

PHP Version

8.1.24

Database Driver & Version

MySQL 8.0.32

Description

At the time of creating a user and applying the unique rule: users, email, the validation is being performed before creating the record and after the record has been created, which is causing the error 'The mutate.0.attributes.email field has already been registered.'

Steps To Reproduce

Rules of validation

`

public function createRules(\Lomkit\Rest\Http\Requests\RestRequest $request)
{
    return [
        'name' => 'required|string|max:255',
        'email' => 'required|email|max:150|unique:users,email',
    ];
}

`

Mutation:

{
    "mutate": [
        {
            "operation": "create",
            "attributes": {
                "name": "test",
                "email": "1@1.com",
            }
        }
    ]
}

Edit 10/11/2023 21:06:00 :

Debugging, I find that the issue arises in the new Hooks features.

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