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
Repeater fails silently and pretty badly on BelongsToMany relationship #5933
Comments
Unfortunately this is a misunderstanding about what the repeater does. The repeater writes to the "related" model of the relationship. In this case, if your repeater is related to In your case, you want to set up a |
No, I didn't misunderstand. In my example it MUST write to the related model, I'm perfecly OK with it. The problem is that it picks the wrong record on the related table: it picks the one with the same id of the pivot table. The example I built is pretty clear, you probably should try it.
When I try to edit TestItem(3) via the repeater, it picks the id from the pivot and edits TestItem(1), since the id of the pivot is 1. This is a obvious bug. Please reopen the issue. |
I'm pretty sure there is an explanation as to why it works that way, when I come back to this issue I'll add more info. |
I'm pretty sure too, and that's why I'm avoiding working it around risking to break other parts of my project. A note: the repeater items in the sent data contain all the field values and all the pivot table values ( |
Could you please take a look? It seems pretty huge to me on a security side (this bug lets/makes you change records you are not intended to change) and it is preventing me to use the system. I tried to inspect what's going on, but the inner workings are not documented enough to let me correctly follow the request's lifecycle. |
Some details. On |
TY |
Package
filament/forms
Package Version
v2.17.15
Laravel Version
v10.3.3
Livewire Version
v2.3
PHP Version
PHP 8.2
Problem description
When I try to update (or delete) a related item via a relationship-based repeater, it updates (or deletes) the related item with the same id of the pivot table record.
Expected behavior
I expect to update or delete the actual record I try to update or deleted, also when its id isn't the same of the pivot table record. At least I expect a failure. Editing another record pretty randomly is very bad.
Steps to reproduce
In general:
In the reproduction repository:
php artisan app:install
. Fill the credentials when asked/admin
and loginReproduction repository
https://github.com/LBreda/filament-repeater-bug
Relevant log output
No response
The text was updated successfully, but these errors were encountered: