Closed buttjer closed 3 years ago
Maybe related to #1745
related to #2128
This issues is actually a much bigger thing then written here.
Not only will it take the first in the pivot fields, but when you actually edit a pivot field, it will update all pivot fields of other records to.
This results in the loss of data of all pivot fields.
+1
This is still the case with Nova 3.7.1
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Any way to get this fixed?
I can't see an easy way to fix this. I've fixed it with adding an ID to the rows of the pivot table. Then using that ID in the views for editing, deleting,... It is a rather heavy customisation that won't fit everyone needs.
I am also experiencing this issue. If you have multiple belongsToMany with custom pivot fields, the pivot fields of other fields show up in error.
The request to get the fields are a GET request to :
/nova-api/products/creation-pivot-fields/products?editing=true&editMode=attach
So it seems it does not specify the relationship you are trying to get the pivot fields for so it can distinguish what fields to show up.
This issues is actually a much bigger thing then written here.
Not only will it take the first in the pivot fields, but when you actually edit a pivot field, it will update all pivot fields of other records to.
This results in the loss of data of all pivot fields.
Yeah this is pretty bad for our use case too as described above. Sorry @crynobone @davidhemphill is there any plans to look at a fix for this please?
This issues is actually a much bigger thing then written here.
This perfectly describe the current state of the issue. I personally have try to look into this and it require major changes to the way pivot table is used in Laravel Nova.
PivotID
, instead of just relying on ID
. This would require eloquent relationship to use Pivot
model explicitly, even then we need to have a way to verify that the pivot model contain a unique id. One way is using $incrementing = true;
.This would also need to be handle for delete (and/or soft deletes).
At the moment I can't guarantee a fixed date when this can be solve but we are looking into it and will release it once we confident with the solution.
PR submitted but still working on adding additional tests for it.
Fixed and released with v3.23.1.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Description:
If you have a Nova Resource which is related mutliple times to the same model, via the same pivot table. And two BelongsToMany Fields and different pivot fields. You will displayed always the first pivot fields.
You would expect to have the input fields of the specific fields method. Not always the first. Both relation pivot forms are the same.
Steps To Reproduce:
Nova/Product.php
Product.php