Create related resource with another relationship

I am making an app to record games, rounds per game, and scores per player per round. I now have a GameResource with a RoundsRelationManager.
On the Game's Edit page I have a table with the rounds and a button to add a new round. I want to open a modal with a form to create a new round.
The modal should have a form with the following fields:
  • Round number (property of the Round model, must only be visible and is a calculated field)
  • Points per player (property of the Score model that is connected to the Round)
  • Winner ID (player ID of the winner, must be calculated upon saving of the Round and Score models, not visible in the dialog)
Now I am diving into the possibilities of creating both the Round and Scores using mutate methods and such, but I feel like there must be a better way to do this that utilizes the relationships in between the models.
I am new to filament, and I am not sure how to approach this.
Some help would be appreciated.

Below is the code I have so far, including a database sketch (players are actually the users in this case):
Was this page helpful?