#Create record with custom creation date
8 messages · Page 1 of 1 (latest)
Do you need the create time stamp to know when the user presses the create button, as opposed to when the record is actually written to row?
Yes I would like to "abuse" the create timestamp to keep track of the button click instead of when the record is written to the db
You could just have a hidden field that will timestamp the form creation time:
->hidden()
->default(now()),```
Then use that field $data to inform the database.
I'd be cautious of interfering with `created_at`, I'd have an alternative field.
Thank @spare mantle ! Any specific reasons for your concerns about using the default field?
Laravel automates a lot of timestamp stuff for you. I can't think of anything off the top of my head...but maybe someone doing something somewhere that relies on an incremental ID field and created_at to match...
I would have to have a very good reason, and no real alternative to manually set a field which 99% of the time, we never touch.
Thank you for sharing, then I will add a custom field to track the process start, it's just adding more complexity, so I thought it would be more aligned if I use the default timestamp column.