Refresh a resource after relation manager triggers model event

Hello! I have a relation manager on a resource, and I'm hoping I can refresh the resource after one of the relations is deleted, because on the resource is updated in the model observer. I can force a redirect back to the same page and that works fine, but it isn't as nice as I'd like it to be. Anyone know if that's possible?
5 Replies
Dan Harrin
Dan Harrin2y ago
you should use a livewire event. emit from the relation manager and listen for it on the page and then refresh the data with ->refreshFormData()
UrbanizedSpy
UrbanizedSpyOP2y ago
great, adding the emit after the detach action and then adding a listener on the edit page worked! Thanks.
Travis
Travis14mo ago
Is this the same approach, in general, to basically make the relation manager "live" or reactive...? I have a similar situation where I want certain form elements to enable/disable (and other things) when changes are made for one of its relations. Working with v3, btw....
Dan Harrin
Dan Harrin14mo ago
Yes, events are the way to go
Want results from more Discord servers?
Add your server