Laravel 5.重置密码后重定向并显示消息

时间:2017-04-11 12:25:46

标签: laravel-5

重置密码后,如何将用户重定向到某条带有消息的路由? 我试图在ResetPasswordController中覆盖redirectTo方法,但我遇到异常Header may not contain more than a single header, new line detected

public function redirectTo()
{
    return redirect()->route('account')->with(['info_message','Password has been changed']);
}

1 个答案:

答案 0 :(得分:2)

redirectTo方法用于获取路由url,即必须是字符串。

在您的情况下,您应该覆盖sendResetResponse中的ResetPasswordController

ResetPasswordController中添加以下内容:

public function sendResetResponse($response) {
    return redirect()->route('account')->with(['info_message','Password has been changed']);
}