Users can register for the website. When they do, it is a three page process. I implemented this by saving the new data to one user DB entry after each page, then storing the user ID in session and fetching at at the next page. I have been trying to find a way to implement a back button so the user can go back and redo their details.
The front end for all three pages is just a typical form structure
<form class="form-horizontal" role="form" method="POST" action="">
<!--fields here-->
<button type="submit">Submit</button>
</form>
The back end for each stage looks like this:
Page 1
public function submitFirst(Request $request)
{
// create user
// put data into user
// save user
// redirect to second page
}
Page 2
public function submitTwo(Request $request)
{
// Fetch user from session
// put data into user
// save user
// redirect to third page
}
Page 3
public function submitTwo(Request $request)
{
// Fetch user from session
// put data into user
// save user
// redirect to login
}
However, if I go back to the first page and fill it in again it will simply create a new user instead of modifying the fields of the current user.
I am wondering what the best solution would be.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2gSIUlc
via IFTTT
Aucun commentaire:
Enregistrer un commentaire