You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The BelongsTo field doesn't always fill when there are two HasMany relationships to the same model. When you go to the detail page of the model and click on 'Create Relation' the BelongsTo field does get filled for the related model in the first relationship but not in the second. For more clarification check below.
Detailed steps to reproduce the issue on a fresh Nova installation:
A complete guide is found in the readme of the reproduction repository but I will copy it here aswell:
Lets say we have a user that can belong to many teams. The TeamUser pivot/model has a role which is used to filter between admins and members.
The Team model has two HasMany relationships to TeamUser admins() and members(), the difference is the filteration on the role column.
Now navigate to the teams resource and go to the detail page of the team.
Click on Create Team User for admins. You can see that the Team relationship is automatically filled with the correct team.
Now go back.
Click on Create Team User for members. You can see that the Team relationship is empty for some reason.
Now go to the file Team Nova resource file and move the members relationship above the admin relationship, and repeat the steps above.
Then you will see the same result but flipped, so it seems like the autofill only works for the first relationship.
The text was updated successfully, but these errors were encountered:
Description:
The
BelongsTo
field doesn't always fill when there are twoHasMany
relationships to the same model. When you go to the detail page of the model and click on 'Create Relation' theBelongsTo
field does get filled for the related model in the first relationship but not in the second. For more clarification check below.Detailed steps to reproduce the issue on a fresh Nova installation:
A complete guide is found in the readme of the reproduction repository but I will copy it here aswell:
Lets say we have a user that can belong to many teams. The TeamUser pivot/model has a role which is used to filter between admins and members.
The Team model has two HasMany relationships to TeamUser
admins()
andmembers()
, the difference is the filteration on the role column.Now navigate to the teams resource and go to the detail page of the team.
Click on Create Team User for admins. You can see that the Team relationship is automatically filled with the correct team.
Now go back.
Click on Create Team User for members. You can see that the Team relationship is empty for some reason.
Now go to the file Team Nova resource file and move the members relationship above the admin relationship, and repeat the steps above.
Then you will see the same result but flipped, so it seems like the autofill only works for the first relationship.
The text was updated successfully, but these errors were encountered: