Файл: app/Rules/ValidateUserPasswordRule.php
Строк: 31
<?php
namespace AppRules;
use IlluminateContractsValidationRule;
use IlluminateSupportFacadesHash;
class ValidateUserPasswordRule implements Rule
{
/**
* The password value to be checked against.
*
* @var
*/
private $password;
/**
* Create a new rule instance.
*
* @return void
*/
public function __construct($password)
{
$this->password = $password;
}
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
* @return bool
*/
public function passes($attribute, $value)
{
if (Hash::check($value, $this->password)) {
return true;
}
return false;
}
/**
* Get the validation error message.
*
* @return string
*/
public function message()
{
return __('The current password is not correct.');
}
}