1
votes

So basically I have a simple form and one of the fields is an email.

My controller responsible for this form is the following(showing only the essentials)

$messages = array(
    'rsvp_email.required' => 'A valid email is required.')
);

$rules = array(
    'rsvp_email' => 'required|max:150|email',
);        

$validator = Validator::make($request->all(), $rules,$messages);

Now there are 2 scenarios:

a) The email is not inserted and the above validation works with the custom message(This works OK)

b) The email is not in a valid format (myemail@email) and the resulted error message is The rsvp email must be a valid email address. which is not what I want to be displayed.

What additional rule should I include for a valid email?

Thank

1
when you enter myemail@email this return "The rsvp email must be a valid email address"? what do you want to show? - Majid Abbasi
I want a custom message, for example "A valid email is required ([email protected])". - Theodoros80

1 Answers

2
votes

IF you want to change this message go to the following path:

resources/lang/en/validation.php

and change value of email index.