I'm currently working with Sessions
in laravel, but I got stacked in here. Here's the scenario, I have a controller
which creates a product item and after that, I have this code:
return redirect()->route('products')->with('success', 'Created!');
and in my view, I'm using sweet alert js plugin
and I have this code.
@if(Session::has('success'))
<script>
swal('Success!', '', 'success');
</script>
<?php Session::flush(); ?>
@endif
So I used Session::flush()
to destroy all the session. I also tried <?php Session::forget('success') ?>
, but no changes was made. My problem is, after I create a product it returns to a view and displays the sweet alert box
, there's nothing wrong with that, but, when I visit the product and click back
button (browser's built-in back button) it displays the sweet alert box
with Created!
message again, which MUST Not be. Why is that?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire