duandi6531 2018-12-10 14:51
浏览 102

如何将状态消息添加到重置密码重定向? (Laravel 5.6)

I'm trying to find a way to add a status message to the default ResetPasswordController redirect, but I can't seem to figure it out. I've tried replacing the default

protected $redirectTo = '/home';

with

public function redirectTo() {
  return redirect()->home()->with('status', 'Your password has been changed successfully!');
}

but I was met with an error. I've read on other posts that the default adds a status message already, but I have an area to show the status and nothing pops up. (Any other status the project has, it shows fine)

@if (session('status'))
  <div class="form-group">
    <div class="alert alert-success alert-dismissible">
      <a href="#" class="close" data-dismiss="alert" aria-label="close"><i class="fa fa-times" aria-hidden="true"></i></a>
        {{ session('status') }}
    </div>
  </div>
@endif

I haven't found any helpful information on this in the documentation either, has anyone found a solution to this?

  • 写回答

1条回答 默认 最新

  • doy57007 2018-12-10 17:32
    关注

    May be this will help.

    public function redirectTo() {
     Session::flash('status', 'Your password has been changed successfully!');
      return redirect('home');
    }
    

    Dont forget to use Session class at top.

    评论

报告相同问题?

悬赏问题

  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?