Skip to content

Fix overwriting updated_at when $set is used. Fix ignoring dateFromat #3433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: 5.x
Choose a base branch
from

Conversation

guram-vashakidze
Copy link

Hello,

  1. Found unexpected behaviour when I'm adding updated_at into $set in Eloquent update. For example:
MyModel::query()
    ->where('foo', 'bar')
    ->update(['$set' => ['...' => '...', 'updated_at' => Carbon::now()->toAtomString()]]);

In this case current implementation is overwrite updated_at

  1. The $dateFormat is ignored when created_at and updated_at are added automatically (when model is saving) and every time set UTCDateTime as format for value in DB. Added check - if dateFormat is set in model -> Date::now() is returned from freshTimestamp instead of UTCDateTime(Date::now())

@guram-vashakidze guram-vashakidze requested a review from a team as a code owner July 24, 2025 16:21
@guram-vashakidze guram-vashakidze requested a review from jmikola July 24, 2025 16:21
@guram-vashakidze
Copy link
Author

UPD: 2nd commit is not solution. My fault.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant