Closed tobias-grasse closed 1 year ago
Please provide full reproducing repository based on fresh installation as suggested in the bug report template (or you can refer to https://github.com/nova-issues for example)
@crynobone I reused the repo for #5536 which already had the models set up, as I'm quite certain it is the same issue with nested forms. I can spin up a fresh reproduction, but the linked repo has no changes other than the barely necessary models + migrations.
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:
Similar to the bug I reported in #5536, contents of a repeater field nested inside a parent resource form (
User
--hasOne-->UserProfile
) are not properly saved when using the JSON preset. Probably because$attribute
does not contain the nesting prefix like$requestAttribute
does. I can work around this with a customfillUsing
callback, but it'd be nice to have this working out of the box. I assume theasHasMany
preset has the same issue, but I did not test this.Repeater field definition on my Nova UserProfile resource:
When I edit the UserProfile resource directly, the form content gets saved without issue. My current workaround is to slap this custom
fillUsing
callback on the field definition:Detailed steps to reproduce the issue on the provided Nova reproduction:
My reproduction defines a User --hasOne--> UserProfile relationship. The UserProfile model has an attribute
extra_field
which is cast toarray
and defined as a JSON column it the migration2023_08_30_060437_add_extra_field_to_user_profiles_table
. Inapp/Nova/UserProfile.php
line 49, this attribute is mapped to a Nova Repeater field.artisan db:migrate --seed
test@example.com
/password
/nova/resources/user-profiles/<id>/edit
user_profiles.extra_field
is empty/nova/resources/user/<id>/edit