laravel / ideas

Issues board used for Laravel internals discussions.
938 stars 28 forks source link

Add parameter for confirmed validation rule - custom matching field name #2517

Closed mesiarm closed 3 years ago

mesiarm commented 3 years ago

rule confirmed (https://laravel.com/docs/8.x/validation#rule-confirmed) should have alternative (maybe confirmed_field?) which would allow to use parameter like this: confirmed_field:password2 which means custom name of matching field instead of predefined {field}_confirmation.

ahinkle commented 3 years ago

Have you tried using the same() rule?

request()->validate([
    'password'   => 'required|string|min:6|max:255',
    'password2' => 'required|string|same:password',
])
mesiarm commented 3 years ago

I didn´t know that, thank you.