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

Messagable::threads() does not respect soft deletes - so how do I truly remove a participant? #379

Closed
cmgmyr opened this issue Jan 21, 2022 Discussed in #376 · 0 comments · Fixed by #380
Closed

Messagable::threads() does not respect soft deletes - so how do I truly remove a participant? #379

cmgmyr opened this issue Jan 21, 2022 Discussed in #376 · 0 comments · Fixed by #380
Assignees
Labels

Comments

@cmgmyr
Copy link
Owner

cmgmyr commented Jan 21, 2022

Discussed in #376

Originally posted by cyrillkalita December 26, 2021
Could be a silly question, really, but BelongsToMany does not account for SoftDeletes.

So a test structured like this, fails:

  • create a thread,
  • add a user participant to a thread
  • remove user participant using removeParticipant()

The pivot attribute deleted_at is populated, as expected.
so:

  1. thread->participants()-count() is 0, as expected, but
  2. $user->threads()->count() still returns 1, because this is how BelongsToMany works

I read #205 and cannot help but wonder: am I missing something obvious?

@cmgmyr cmgmyr self-assigned this Jan 21, 2022
@cmgmyr cmgmyr added the bug label Jan 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant