本文介绍了如何返回带有Flash消息的视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要的是这个
return view('protected.standardUser.includes.documents',compact('documents'))->with('successMsg','Property is updated .');我可以这样使用它:
@if(Session::has('successMsg')) <div class="alert alert-success"> {{ Session::get('successMsg') }}</div> @endif有什么建议吗?
推荐答案似乎您正在混用两种不同的方式将数据传递给视图,我猜这就是问题所在. 文档似乎表明这是一种或另一种情况.您似乎还混淆了view()->with()和redirect()->with(),它们的工作方式不同.试试这个:
It looks like you're mixing two different ways of passing data to a view, which I'm guessing is the problem. The documentation seems to indicate it's a one or the other type situation. You also seem to be mixing up view()->with() and redirect()->with(), which work differently. Try this:
return view('protected.standardUser.includes.documents')->with('documents', $documents)->with('successMsg','Property is updated .');还有
@if(!empty($successMsg)) <div class="alert alert-success"> {{ $successMsg }}</div> @endif更多推荐
如何返回带有Flash消息的视图?
发布评论