Skip to content

[13.x] Fix: add missing check for #[WithoutTimestamps] on model ignore touch - #61073

Merged
taylorotwell merged 1 commit into
laravel:13.xfrom
bram-pkg:read-withouttimestamps
Aug 6, 2026
Merged

[13.x] Fix: add missing check for #[WithoutTimestamps] on model ignore touch#61073
taylorotwell merged 1 commit into
laravel:13.xfrom
bram-pkg:read-withouttimestamps

Conversation

@bram-pkg

@bram-pkg bram-pkg commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Currently the #[WithoutTimestamps] attribute is ignored when checking if a model is supposed to be touched, and only #[Table(timestamps: false)] is checked. Behaviour should be the same between these two.

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown

Thanks for submitting a PR!

Note that draft PRs are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@bram-pkg
bram-pkg force-pushed the read-withouttimestamps branch from 4e97714 to b2a13b6 Compare August 6, 2026 10:26
@bram-pkg bram-pkg changed the title Add check for #[WithoutTimestamps] attribute on ignore touch [13.x] Fix: add check for #[WithoutTimestamps] attribute on ignore touch Aug 6, 2026
@bram-pkg bram-pkg changed the title [13.x] Fix: add check for #[WithoutTimestamps] attribute on ignore touch [13.x] Fix: add check for #[WithoutTimestamps] attribute on ignore touch Aug 6, 2026
@bram-pkg bram-pkg changed the title [13.x] Fix: add check for #[WithoutTimestamps] attribute on ignore touch [13.x] Fix: add missing check for #[WithoutTimestamps] on model ignore touch Aug 6, 2026
@bram-pkg
bram-pkg marked this pull request as ready for review August 6, 2026 10:28
@taylorotwell
taylorotwell merged commit a4ba5c4 into laravel:13.x Aug 6, 2026
52 of 53 checks passed
@bram-pkg
bram-pkg deleted the read-withouttimestamps branch August 6, 2026 14:37
eas4ai added a commit to eas4ai/suprnova that referenced this pull request Aug 19, 2026
Adds the runtime cascade for `#[model(touches = [...])]`: after a
child model is created, saved, updated, deleted, or force-deleted,
every declared `BelongsTo` owner gets one
`UPDATE <owner> SET updated_at = ? WHERE <key> = ?` on the same
executor as the triggering write, so it joins an ambient
`DB::transaction` and rolls back with it.

- `EloquentModel` gains `TOUCHES`, `HAS_TIMESTAMPS`, `UPDATED_AT_COLUMN`
  consts; `RelationEntry` gains `related_updated_at_column`, collapsed
  from the target's two consts via the new `touch_column` const fn.
- `Model::touch_owners` / `touch_owners_with_tx` / `__touch_owners_via`
  are new trait-default methods, wired into all 10 write-path call
  sites (create/save/update/delete/force_delete + the five `_with_tx`
  shims) and into the soft-delete macro's inherent delete/force_delete
  overrides.
- `without_touching_on::<M, _, _>` adds a per-type suppression scope
  (Laravel's `withoutTouchingOn`), and the existing `without_touching`
  now also suppresses the owner cascade, not just direct `.touch()`.
- The macro validates `touches` at expansion time: every name must
  resolve to a declared `BelongsTo` relation, or it's a compile error.
- An owner with `timestamps = false` is skipped, not written and not
  an error (laravel/framework#61073); same for a NULL FK or a
  soft-deleted owner.
- Breaking change: `TOUCHES` moves from an inherent const to
  `EloquentModel`, since the cascade needs it reachable from a trait
  default. `Comment::TOUCHES` still resolves with `EloquentModel` in
  scope.

Deliberately out of scope: `restore()` does not touch (Suprnova's
restore is a raw UPDATE, not a `save()`), and the cascade is one level
deep and event-free (no parent hydration, no grandparent recursion, no
parent `saved` event) - both documented in manual/eloquent.md's "Why
Suprnova diverges".

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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