lundi 24 juillet 2017

Laravel echo session value or default

I have a redirect from my controller:

return redirect()->back()->with('auto', time());

And in my blade template:

<input type="hidden" name="auto" value="">

However, when I get redirected back to the page, my input has the value 1 instead. No matter what value I redirect it, it's echoing 1, which stands for true I suppose.

So I'm doing it like this:

<input type="hidden" name="auto" value="<?php echo session('auto') ? session('auto') : 'abcd'; ?>">

How can I get the value of session('auto)` the Laravel way?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire