Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

robjesus's avatar

Date format for validation messages

Hello everyone. Is there a nicest way to format :date params at validation.php? This one, for example: 'after' => 'O campo :attribute deve ser uma data posterior a :date'

0 likes
1 reply
robjesus's avatar
robjesus
OP
Best Answer
Level 1

I'm using FormRequest, so, this is what I did:

public function messages()
{
    return [
        'after' => 'A :attribute deve ser uma data posterior a '
            . $this->project->start_date->format('d/m/Y'),
    ];
}

It works, but I'm still open to sugestions.

Please or to participate in this conversation.