Level 6
you can add the user input with the :input placeholder
like so:
return [
'email' => 'The email :input is already taken.',
];
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi,
I've just created a new Request to use in my controller with the command artisan make:request.
My doubt is if is there a way to add the value content inside messages() method.
My request is something similar to:
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'email' => 'required|email|unique:mysql.users,email',
'birthdate' => 'required|date|before:today',
];
}
public function messages(): array
{
return [
'email' => 'The email is already taken.',
];
}
I would like to return a message in case it fails like: "The email '[email protected]' is already taken".
Thank you so much! :)
you can add the user input with the :input placeholder
like so:
return [
'email' => 'The email :input is already taken.',
];
Please or to participate in this conversation.