0

I try to submit a form and redirect back to it after submitting. If the submit was successful, then I want to show a message, e.g. successfully stored data

I tried to redirect back with the message like this:

return redirect()->back()->with("message", "successfully stored data");

And in the view...

    @if(isset($message))
        <center><p> {{ $message }} </p></center>
    @endif

However, this does not work.

This is all I get back:

array:4 [▼
  "__env" => Factory {#89 ▶}
  "app" => Application {#3 ▶}
  "errors" => ViewErrorBag {#187 ▶}
  "AllSettings" => Settings {#202 ▶}
]
Black
  • 18,150
  • 39
  • 158
  • 271
  • Does `->with(["message" => "..."]);` work? (Accessed with `\Session::get("message")`) – Tim Lewis Mar 21 '17 at 14:48
  • No does not work either. – Black Mar 21 '17 at 14:50
  • 1
    @AlexeyMezenin Laravel 5.4 as I already mentioned in the title. And I just posted the relevant view snippet. No middleware used. I found the solution in the duplicate question. – Black Mar 21 '17 at 14:53

0 Answers0