Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model::withoutTouching does not work for BelongsToMany #49777

Closed
NiroDeveloper opened this issue Jan 22, 2024 · 1 comment · Fixed by #49798
Closed

Model::withoutTouching does not work for BelongsToMany #49777

NiroDeveloper opened this issue Jan 22, 2024 · 1 comment · Fixed by #49798

Comments

@NiroDeveloper
Copy link

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
Copy link

Thank you for reporting this issue!

As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub.

If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants