Laravel password and confirm password validation

In this tutorial we will discuss laravel validation rule for same password value in confirm password field. password validation rule in laravel 8, laravel 9 and laravel 10.



Laravel password and confirm password validation

Laravel use confirmed validation rule for validate same password value in password_confirmation field.

When we use confirmed validation rule in a field then an another filed must have same value which name {field}_confirmation. another example phone and phone_confirmation

View file
  <input type="password" name="password" required>
  <input type="password" name="password_confirmation" required>
App/Http/Controllers/UserController.php
<?php
namespace App\Http\Controllers;

use Illuminate\Http\Request;

class UserController extends Controller
{
  public function store(Request $request) {
    $request->validate([
      'password' => 'required|confirmed|min:6',
    ]);
  }
}
php laravel developer anmol sharma

Anmol Sharma

I am a software engineer and have experience in web development technologies like php, Laravel, Codeigniter, javascript, jquery, bootstrap and I like to share my deep knowledge by these blogs.

Random tutorial links