update password

This commit is contained in:
afiq
2022-01-25 10:05:24 +08:00
6 changed files with 162 additions and 9 deletions
+31
View File
@@ -0,0 +1,31 @@
<?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.';
}
}