Skip to content

[12.x] Allow touch() to accept multiple columns - #59175

Merged
taylorotwell merged 2 commits into
laravel:12.xfrom
devajmeireles:feat/touch-multiple-columns
Mar 13, 2026
Merged

taylorotwell merged 2 commits into
laravel:12.xfrom
devajmeireles:feat/touch-multiple-columns

Conversation

@devajmeireles

Copy link
Copy Markdown
Contributor

This PR extends Builder::touch() and Model::touch() to accept an array of column names, allowing multiple timestamp columns to be updated in a single query.

Before

$model->touch('published_at');

$model->touch('verified_at'); // two queries

After

$model->touch(['published_at', 'verified_at']); // single query

Both touch() and touchQuietly() on the model, as well as Builder::touch(), now accept string|array|null. Full backward compatibility was preserved, ensuring that introducing this feature will not break anything.

@taylorotwell
taylorotwell merged commit 651ead2 into laravel:12.x Mar 13, 2026
70 checks passed
jonagoldman pushed a commit to deplox/laravel-framework that referenced this pull request Apr 30, 2026
* [feat] allow touch in multiple columns at the sametime

* formatting

---------

Co-authored-by: Taylor Otwell <[email protected]>
binaryfire added a commit to hypervel/components-backup that referenced this pull request Oct 1, 2026
Port refreshForUpdate with the shared refresh query path, upstream unit and integration coverage, and usage documentation. Preserve model key validation and relationship reload behavior.

Make relationship touching honor WithoutTimestamps and the same property/attribute precedence as model initialization. Disabled models could otherwise write updated_at, including on tables without that column. Strengthen the precedence cases and reconcile both attribute cache-order tests against the existing instance-based cache.

Complete the missing multi-attribute touch model test and documentation. Use the upstream keyed AsPivot lookup in the moved refresh helper; the rest of the trait lookup PR remains under reconciliation.

Upstream: laravel/framework at 01d008c9b5f32cb7c5e50a9a22273113d810b2a2.

laravel/framework#61247
laravel/framework#59175
laravel/framework#61073
laravel/framework#60815
laravel/framework#59457

Validation: timestamp precedence regressions failed before the correction and pass afterward; SQLite relation touching verifies inherited disabling. Changed test files, affected Eloquent ParaTest, full source/type analysis, and scoped formatting pass. Refresh integration tests also pass after the final trait lookup correction.
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