Skip to content

[9.x] Fix updated_at timestamp not updating when field is read-only#807

Merged
duncanmcclean merged 3 commits into
9.xfrom
read-only-timestamp
Apr 17, 2026
Merged

[9.x] Fix updated_at timestamp not updating when field is read-only#807
duncanmcclean merged 3 commits into
9.xfrom
read-only-timestamp

Conversation

@duncanmcclean

Copy link
Copy Markdown
Member

This pull request fixes an issue where the updated_at timestamp wasn't being updated when it was configured as a read_only field in the blueprint.

This was happening because read_only fields are still saved, so the value was run through the fieldtype's process() method and set on the model via setAttribute. This made the updated_at attribute dirty in the model's attributes array, which prevented Laravel's updateTimestamps() from auto-updating the timestamp (it skips columns that are already dirty), causing the stale value to be saved.

This PR fixes it by skipping setAttribute for timestamp columns (updated_at/created_at) when the field is read_only and the model uses timestamps, allowing Laravel's automatic timestamp handling to work as expected.

Fixes #805

@duncanmcclean duncanmcclean merged commit bdca755 into 9.x Apr 17, 2026
16 checks passed
@duncanmcclean duncanmcclean deleted the read-only-timestamp branch April 17, 2026 11:31
@github-actions

Copy link
Copy Markdown

Released as part of v9.4.4.

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.

Updated_at readonly does not update correctly. Computed does but is not sortable.

1 participant