Displaying fields from an intermediary table on a Nova resource relationship
Hi there!
I have a Nova resource called a Shift. This resource can have multiple Practitioners allocated to it, and has a many-to-many relationship with the Practitioner model. The table that I use to store these entries is called shift_practitioner and I have a relationship on by Shift model called allocated_practitioners that references this table. Now, my shift_practitioner table has some additional fields of interest to me, and I want to be able to display these fields in the Nova Shift resource. So on the resource, I declare the following:
BelongsToMany::make('Practitioner', 'allocated_practitioners')
->fields(function ()
{
return [
Text::make('Completion Status Id'),
Text::make('Eta'),
Text::make('Distance From Shift'),
DateTime::make('Actual Start Time'),
DateTime::make('Actual End Time'),
];
}),
However, when I visit Nova and open a specific Shift, I just see the normal fields related to a Practitioner under this section and I don't see the custom fields that I am setting here. How can I get Nova to display these fields instead?
Please or to participate in this conversation.