Skip to content

Model::withoutTouching does not work for BelongsToMany #49777

Closed
@NiroDeveloper

Description

@NiroDeveloper

Laravel Version

10.41.0

PHP Version

8.1.27

Database Driver & Version

No response

Description

BelongsToMany::touch() does not call Model::isIgnoringTouch() to check if the models should be touched, so Model::withoutTouching() is not working for Many-To-Many relations.

Steps To Reproduce

  1. Create two Models with Many-To-Many relation
  2. Add $touches variable to the models and add the other model
  3. Update one model by Model::withoutTouching(fn() => $model1->update(['column' => '::newVallue::']))
  4. Check that both updated_at columns got updated

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions