How to get the current relationship entry on a RelationManager action?
My goal is to get the current relationship information, let me explain. Let's say that I have an Order model, a Product model and a many to many relationship between them using BelongsToMany in both models. I'm using a relation manager to attach products to an order.
For example, If I use this on an AttachAction
That "recordId" is the id of the product that was attached via the relationship. However, is there a way to access the pivot table information? Let's say I have a pivot table named "order_products", every time I "attach" a product to an order, there's a new entry on that table.
Is there like an event that is emitted as described in the Form Builder documentation? Or maybe in the livewire object that I use in the callback? Where do I found that recently created row in the pivot table?
For example, If I use this on an AttachAction
->after(function (RelationManager $livewire) {
dd($livewire->mountedTableActionData['recordId'];
$livewire->emit('refresh');
})That "recordId" is the id of the product that was attached via the relationship. However, is there a way to access the pivot table information? Let's say I have a pivot table named "order_products", every time I "attach" a product to an order, there's a new entry on that table.
Is there like an event that is emitted as described in the Form Builder documentation? Or maybe in the livewire object that I use in the callback? Where do I found that recently created row in the pivot table?