I am having problems with my session flash message
I have a simple logic like this
if(empty($code))
{
return redirect()->back()->with('modal', 'working');
}
And in my view file I am doing alert for testing
@if(session('modal'))
<script>
alert('working');
</script>
@endif
The problem is this alert('working'); gets executed two times. So, when it's redirecting back, one time it immediately executes and second time, it executes after loading document.
I tried various workarounds like deleting session key, loading on document ready for javascript, but nothing works.
What could be the issue?