Answers for "laravel cannot validate password"

PHP
1

validate password laravel

$request->validate([
            'email' =>'required|exists:users',
            'password'=>'required|password'
        ]);
Posted by: Guest on July-07-2021
0

laravel validate change password

<?php
  
namespace App\Rules;
  
use Illuminate\Contracts\Validation\Rule;
use Illuminate\Support\Facades\Hash;
  
class MatchOldPassword implements Rule
{
    /**
     * Determine if the validation rule passes.
     *
     * @param  string  $attribute
     * @param  mixed  $value
     * @return bool
     */
    public function passes($attribute, $value)
    {
        return Hash::check($value, auth()->user()->password);
    }
   
    /**
     * Get the validation error message.
     *
     * @return string
     */
    public function message()
    {
        return 'The :attribute is match with old password.';
    }
}
Posted by: Guest on January-07-2022

Code answers related to "laravel cannot validate password"

Browse Popular Code Answers by Language