'require|mobile', 'code' => 'require', 'old_password' => 'require', 'password' => 'require|length:6,20|different:old_password', 'password_confirm' => 'require|confirm', ]; protected $message = [ 'phone.require' => '请输入手机号', 'phone.mobile' => '请输入正确手机号', 'code.require' => '请填写验证码', 'password.require' => '请输入新密码', 'password.length' => '密码须在6-25位之间', 'password.different' => '新密码不能和原密码一样', 'password_confirm.require' => '请确认密码', 'password_confirm.confirm' => '确认密码和新密码不一致', 'old_password.require' => '请输入原密码', ]; //重置登录密码 public function sceneResetPassword(): PasswordValidate { return $this->only(['phone', 'code', 'password', 'password_confirm']); } //修改密码场景 public function sceneChangePassword(): PasswordValidate { return $this->only(['old_password','password', 'password_confirm']); } }