Retrieving course and stream names in pivot table for AttachAction in Filament

I'm currently facing an issue with retrieving course and stream names in a pivot table while using the AttachAction in Filament. I hope someone can provide some guidance or suggestions to help me resolve this problem. Here's the scenario: I have a pivot table named classes_teacher which includes foreign keys classes_id, stream_id, course_id, and teacher_id. This table is used in the AttachAction of the relation manager TeachersRelationManager within the ClassesResource. The relationship name is "teachers". To enhance the AttachAction, I have created a custom form that includes three select fields: teacher_id, stream_id, and course_id. The form successfully saves the data to the database when attaching a record. However, I am facing two specific issues: 1. Course name retrieval: While the course name is displayed correctly for the first attached record, it is not displayed for subsequent records. I would like to ensure that the course name is displayed for all attached records. 2. Stream name retrieval: The stream name is not displayed at all in the form for any attached records. I would like to resolve this issue and have the stream name displayed correctly. I suspect that there might be an issue with how I am retrieving the course and stream names in the form, possibly related to the pivot table structure or the relationship configuration. Could someone please guide me on how to address these issues? Any insights, code examples, or suggestions to resolve this problem would be greatly appreciated. Thank you in advance for your help and support!
1 Reply
Dan Harrin
Dan Harrin2y ago
well to start with, you have a streams relationship, not stream
Want results from more Discord servers?
Add your server