Pretty basic things going on. Using Session Flash
messages to display any success/error messages.
All routes are set-up in my 'middleware' => 'web'
group.
Now my problem. ->flash()
does not work whilst ->put()
does.
Controller:
$request->session()->flash('alert-success', 'My flash message');
Blade:
@foreach (['danger', 'warning', 'success', 'info'] as $msg)
@if(Session::has('alert-' . $msg))
<p class="alert alert-{{ $msg }}">{{ Session::get('alert-' . $msg) }} <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
</p>
@endif
@endforeach
The return redirect('routeHere')->with('alert-success', 'My flash message');
stated in the Laravel 5 docs doesn't work either.
Edit
Laravel 5.2 Session flash not working even with web middleware duplication. Using ['middlewareGroups' => 'web']
instead of ['middleware' => 'web']
does fix the problem but assuming this is not the way to go.