I am building a multiple steps registration form. I will only allow the user to progress to next step when the current step is fully validated. I will also store all the information in the session
and when I have everything I will persist it to the database.
My steps will involve different fields like: user details with address, business details and that will have address fields as well, and then a few other fields. However some users will need to fill in the address while other won't be required.
- UserDetailsRequest (without including addresses)
- BusinessDetailsRequest (without including addresses)
- AddressRequest
- ExtraFieldsRequest
OR
- UserDetailsRequest (with addresses)
- BusinessDetailsRequest (with addresses)
- ExtraFieldsRequest
Can I combine the requests in my controller depending on the user type and if they are required to provide an address?
In general, do I need to create as many requests as I have forms on my project? Can I instead create a 'bigger' form request and put some logic in it?