Mutated date columns being set to current timestamp

Posted 1 year ago by bradbforbes

I have an Eloquent model with an attribute included in the $dates array. For some reason, I’m having a problem with the value of this column sometimes being persisted as the current timestamp when the model is saved, so that it ends up matching 'updated_at' exactly. I’ve seen this happen in two different models in two different Laravel apps I maintain recently, and in both cases I can’t track down the cause of this for the life of me. Neither applications have a usage that would ever explicitly set this attribute value to the current time, so I'm wondering if there's something about how Eloquent mutates dates that I just don't understand. Does anyone know what may be causing this? Thanks!

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.