I just implemented something similar in a project I am working on.
Our solution is to have a post route without an auth filter that validates the data so we can redirect back with errors (if failed) before showing the login form. If the validation is successful, we put the data from the form into a session attribute then redirect to the login form.
After the user logs in, we check for this session attribute. If it exists, we redirect them to the next stage (in our case a larger form with some info prefilled, but you could redirect to a route that handles the submission). This next stage route (with auth filter) checks for the existence of the session attribute (so an authenticated can't access the page without having filled in the previous form) then retrieves the data from the session and continues as if the first form was submitted to it.
Typed this out on my iPad so I hope it makes sense.
Thanks a lot, I also thought that was the only way to achieve this !
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community