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

TriciaC's avatar
Level 10

current_password validation

I am trying to validate an input using the current_password rule (https://laravel.com/docs/8.x/validation#rule-current-password ) but I always get the following error:

Method Illuminate\Validation\Validator::validateCurrentPassword does not exist.

This is the code in my Request:


    public function rules()
    {
        return [
            'password' => 'current_password',
            'new_password' => 'required|confirmed|min:8|string'
        ];
    }

I have also tried 'password' => 'current_password:web'

but I get the same error.

I am using a new install of Laravel 8.46.0

0 likes
4 replies
tykus's avatar

It used simply be called password, not current_password - I wonder if the docs are anticipating an upcoming change that has not yet been implemented?

    public function rules()
    {
        return [
            'password' => 'password',
            'new_password' => 'required|confirmed|min:8|string'
        ];
    }
1 like
RodrigoG's avatar

Do you mean that until a new update in laravel this validation rule cannot be used? Thanks!

anilkumarthakur60's avatar

how about trying this one make the new rules as

<?php

namespace App\Rules;

use Illuminate\Contracts\Validation\Rule;
use Illuminate\Support\Facades\Hash;

class MatchOldPassword implements Rule
{
    public function __construct()
    {
        //
    }


    public function passes($attribute, $value)
    {
        return Hash::check($value, auth()->user()->password);
        //
    }


    public function message()
    {
        return 'Current Password Miss match';
    }
}

your controller update method validation

  $request->validate([
            'current_password' => ['required', new MatchOldPassword],
            'password' => ['required', 'string', 'min:8', 'confirmed'],
        ]);

Please or to participate in this conversation.