How to show toast message when performing delete in index page?
I need to popup a feedback when user is deleting stuff from index page. Preferably, a toast message like the one we get when we create or updating resources. Nova, by default, already have this message pop up when user deleting stuff from Detail page. However, for index/list page, the user get nothing. Sure, we get the refresh and hopefully the data is also gone from the list when the refresh is done, but it's a very different UX compared to other action in the page, and even the same action done from a different page.
My goal is to provide the same UX for this, which is simply to show success/error message when the action is finished.
There are a few things I've tried:
-
Observerfor models. While I can hook into the 'finish delete' event with this, Nova won't let me send a feedback message becauseAction::message()only work forActions (github.com/laravel/nova-issues/issues/2196#issuecomment-561243512). I could useabort(500, 'error msg');(github.com/laravel/nova-issues/issues/2196#issuecomment-561229525) but it only works for errors. -
Custom resource tool. I've tried this because it seem the workaround in old Nova (github.com/laravel/nova-issues/issues/786). However, after trying, I found the component only show up in detail page, so not the solution I'm looking for.
-
Custom action. This works..., but then it'd clash with original delete button and present a different UX (because it'll be under the three-dots button or action dropdown).
Is there a way to do this in Nova 4? All the workarounds I see is for old Nova and some say it doesn't work anymore with Nova 4.
Please or to participate in this conversation.