Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel validation translate (german)

Tags:

laravel

I have this validation rule

'event_start' => 'required|date|after:today',

and i can't find where to translate the word "today".

When i hit the validation rule i get this message:

Eventstart muss ein Datum nach dem today sein.

I have german locale and this is the validation translation

'after' => ':attribute muss ein Datum nach dem :date sein.',

and i can't find where to edit the word today.

like image 275
lewis4u Avatar asked Nov 23 '25 16:11

lewis4u


1 Answers

If you are using FormRequest class, you can add the messages method to it like this:

public function messages() 
{
  return [
    'event_start.after' => 'Eventstart muss ein Datum nach dem today sein.'
  ];
}

Or add the:

'custom' => [
  'event_start' => [
    'after' => 'Eventstart muss ein Datum nach dem today sein.'
  ]
],

to the validation.php file.

Im pretty sure, that you can't just translate the :date.

like image 98
Lado Lomidze Avatar answered Nov 27 '25 01:11

Lado Lomidze



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!