Display concatenated data within the Relations Manager
Hello everyone,
I have a model called Lesson, which has relationships with two other models, Slide and Accordion, using a hasMany relation. I would like to create a table that displays concatenated data from these two child models within the Relations Manager of the Lessons resource. Additionally, I would like to have the ability to modify the records of these specific models.
I've attempted to create relation components() in the Lesson model and return the union of two relations, slides() and accordions(). The data is displayed correctly, but when I attempt to edit the record using the built-in modal form, the wrong record is displayed. I suspect that the returned object of the relationship is of type App\Models\Slide, and it may be attempting to retrieve the record from that Slides model instead.
The primary objective is to create a table that combines data from multiple models and provides the ability to reorder them later using the built-in table's reordering functionality.
0 Replies