Show modal instead of toast after CreateRecord in Filament v4
Hi! đź‘‹
I’m building a CreateRecord in Filament where I generate a Passport Client.
In the
handleRecordCreation()
method I get the client_id
and the plainSecret
(only available right after creating the client).
Currently, I’m displaying these values in a toast notification using getCreatedNotification()
, but instead I’d like to show them in a modal (so the user can easily copy them).
My question is:
Is it possible to replace the toast notification with a modal in the CreateRecord flow?
And if so, what’s the recommended approach in Filament v4? (e.g. using afterCreate + Filament modal, or is there something built-in like with notifications?).
Thanks in advance! 🙏2 Replies
this is my method getCreatedNotification
Hey, I was curious about this problem so made a few attempts with chatgpt and one of them did work, use this code as an idea. But also, I'm not sure I like this workflow, as then the user stays on the page of Create, so UX is pretty weird.
And then inside also:
So, it "kinda" works but I wouldn't probably recommend it. Maybe choose to redirect to a separate PAGE instead with copyable things and then navigate from there?