@vable show where and how you store your session before going back
Retrieve Session after redirect->back() on validor fails
Hello everyone ! I've an old Laravel 5.4 version with a multistep form. On each step, I validate the step and store the values of the form on the session with a specific key. Nothing is stored on the database until the final step.
eg :
[
'form' => [
'input1' => 'value1',
'input2' => 'value2',
...
]
]
The problem is when I validate the form and an error occur, I display a SweetAlert modal with the errors. It just the default redirect :
if ($validator->fails()) {
return redirect()
->back()
->withErrors($validator)
->withInput();
}
When I resubmit the form, as I retrieve the session when saving to the database, I get errors telling me that the session does not exist.
If I do a dd() of the session, yes, I no longer have the form-related session, but only the errorBag and the old values of the last step of the form.
I tried to put a Session::save() before the redirect (like I can see in this topic), but it doesn’t change anything.
Do you know how can I persist/retrieve the Session values after a redirect()->back() ? Thanks in advance for your help :)
Please or to participate in this conversation.