I am trying to set a session flash message in blade file in lumen 8. However it's stated a pervious version but not present in latest doc.
Here is my code snippet
In Controller:
public function foo()
{
....
return redirect('contact')->with('status', 'Message sent successfully !');
}
In blade:
@if (session('status'))
<div class="alert alert-success">
{{ session('status') }}
</div>
@endif
But it's not working & throwing an error
Call to undefined function Session()
How can I set a flash message in blade after redirect ?
You can not directly use Session in Blade tamplate.
First you need to use ill..\Session:class In middleware..
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community