0
我正在使用Laravel 4.2,并且希望在表单提交之前使用类似模式的方式确认用户的密码,而无需进行实际的提交。如果密码匹配,请执行提交;如果没有,保持在同一页面没有重新加载,这是可能的?在Laravel提交表单之前确认密码
我该怎么做?在您的规则
public function afterValidate() {
if (count($this->errors()->toArray())==0 && !empty($this->password) && $this->password!=$this->getOriginal('password')) {
$this->password = Hash::make($this->password); // encrypting the password
unset($this->password_confirmation); // dropping password confirmation field
}
}
此: