does your dashboard display finish normally or do you halt it with dd or die ?
Sep 24, 2018
2
Level 6
Redirecting With Flashed Session Data returns flashed session TWICE
This is annoying me. I'm successfully redirecting and flashing a status message, but it appears AGAIN if I click on another page. The next page click or redirect the session has cleared. I don't want this message to show up twice.
My controller
if($saved)
{
return redirect('/dashboard/school-year')
->with('toastr', 'Success!')
->with('success', 'New school year created.');
} else {
return redirect('/dashboard/school-year')
->with('toastr', 'Error!')
->with('error', 'Hmmm... there was some type of error with this.');
}
my blade:
@if(session('toastr'))
@if(session('success'))
{{ \Toastr::success(session('success'), session('toastr'), $options = []) }}
@elseif(session('error'))
{{ \Toastr::error(session('error'), session('toastr'), $options = []) }}
@elseif(session('warning'))
{{ \Toastr::error(session('warning'), session('toastr'), $options = []) }}
@elseif(session('info'))
{{ \Toastr::error(session('info'), session('toastr'), $options = []) }}
@endif
@endif
Again, it's working properly, it just shows twice (going to another page) before it's removed.
Please or to participate in this conversation.