Skip to content

Add a array of fields' custom attributes to validation language files #10

@renjithspace

Description

@renjithspace

Here is my validation:

Validator::validate($request->all(), [
    'avatar.uri' => 'required',
]);

So I receiving the validation error like below.

The avatar.uri field is required.

I wanted to update the message to like as below.

The photo field is required.

I wanted to update avatar.uri attribute name to photo. So I updated language files like below. But not working.

// resources/lang/en/validation.php

'attributes' => [
    'avatar.uri' => 'photo'
],

I tried another method, this also not working:

// resources/lang/en/validation.php

'attributes' => [
    'avatar' => [
        'uri' => 'photo'
    ]
],

How can I achieve that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions