why are you doing a redirect()->back().
just return back();
also there is no alert-error it's alert-danger (unless you have your own.)
but you are saying the 'type' works but there is message does not display?
what version of laravel are you using?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, i'm trying to display a error/success message after a request, but it's not displaying, when i dump it the message is there, and the first part when i display the type of the message works properly
here's my code, need some help, guys!
return redirect()->back()->with('type', 'error')
->with('message', 'try again!');
@if (session('message'))
<div class="alert alert-{{ session('type') }}">
{{ session('message') }}
</div>
@endif
Please or to participate in this conversation.