Displaying Relationship Records in Filament Table instead of Owner Model's resources

Hi, I'm having a problem with my custom Table display. For ex: I have 2 Models: "Product" & "Order", which has belongsToMany to each other as their relationship, and using "OrderProduct" pivot model to store their pivot data. I created the "OrderResource" as normal, and I want to display the list of OrderProduct in this Resource Table rather then the default Order model as usual, and why I click to the record, it will point me to the create/edit OrderResource. How can I archive this? I have tried the $table->query(OrderProduct::query()) method, but as soon as I clicked on the record, it throw the error as Order Resources Form contained the relationship to the OrderProduct pivot model. Hope you guys understand what i'm trying to say. Thank you!
3 Replies
Zen Nitiruj
Zen Nitiruj3d ago
I think you may need to cutom the table View action too.
Hung Thai
Hung ThaiOP3d ago
thank you for your replied. But, can you be more specific? You mean I have to customize all the Edit/Delete/View Action in the $table->actions() method?
Mohamed Ayaou
Mohamed Ayaou3d ago
I think you will need to customize the relation manager too as you did with the normal table as your use case is not usual it will be hard to help, sorry

Did you find this page helpful?