Skip to content

[8.x] fix updated with provided qualified updated_at#41133

Merged
taylorotwell merged 1 commit into
laravel:8.xfrom
rodrigopedra:check-qualified-updated-at
Feb 21, 2022
Merged

[8.x] fix updated with provided qualified updated_at#41133
taylorotwell merged 1 commit into
laravel:8.xfrom
rodrigopedra:check-qualified-updated-at

Conversation

@rodrigopedra
Copy link
Copy Markdown
Contributor

@rodrigopedra rodrigopedra commented Feb 21, 2022

Fixes #41128

This work as expected:

User::query()->update(['updated_at' => null]);

While this does not:

User::query()->update(['users.updated_at' => null]);

This PR:

  • Fixes the Eloquent\Builder@addUpdatedAtColumn to verify for a qualified updated account
  • Adds two relevant tests that would not pass without the changes proposed in this PR

Notes:

  • As this is a bug fix I targeted branch 8.x
  • The reason I used Arr::get(...) instead of the null coalescing operator is to allow users to specify a null value as they can when not qualifying the updated_at column

@rodrigopedra rodrigopedra changed the title [8.x] fix updated with provided qualified updated_at - closes #41128 [8.x] fix updated with provided qualified updated_at Feb 21, 2022
@taylorotwell taylorotwell merged commit 424bdd4 into laravel:8.x Feb 21, 2022
@rodrigopedra rodrigopedra deleted the check-qualified-updated-at branch February 21, 2022 18:06
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.

2 participants