Use a proper date format. This is a computer, not an american :)
2022-11-30 for example
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello friends,
When I use the After and Before rules in Laravel 9, I cannot get the value that should belong to the rules within the rules I defined in the Validation class in the message section. I am writing the example below. The error message reads like this:
Date :after has to be big
or
Date :before has to be small
Date 11/30/2022 has to be small or Date 11/01/2022 has to be big
public function rules(): array
{
return [
'name' => 'required|min:2',
'date=> 'required|after:11/01/2022|before:11/30/2022',
];
}
public function messages(): array
{
return [
'name.required' => 'Please Enter Username',
'name.min' => 'Username must contain at least :min characters',
'date.required' => 'Please Select Date',
'date.after' => 'Date :after has to be big',
'date.before' => 'Date :before has to be small',
];
}
@tbahadir Oh strange, that straight out of the official translations: https://github.com/laravel/laravel/blob/9.x/lang/en/validation.php#L19
What string do you expect it to show?
Please or to participate in this conversation.