Support the ongoing development of Laravel.io →
Requests IOC Forms
Last updated 2 years ago.
0

My approach will be to have a class called ViewFormModel which will hold all the properties the form will display. When the form is filled, u simply update the fields in the class, serialize and save the data to session. When you ready to save it to the database, you init your DB model from the ViewFormModel and save to DB.

Reason I am using ViewFormModel is to keep the size of data small. We don't want to save an entire Eloquent model in session when we not sure we need it until after confirmation.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

mseymour mseymour Joined 25 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.