F
Filamentβ€’2y ago
Prodex

Access record after creation

How can I access or get the created record inside the afterCreate() hook? I need to do stuff after the creation but need the record id for it. The handleRecordCreation() doesn't really fit, because I do want to let that handling automatically (with relations etc.) Thank you!
2 Replies
Kenneth Sese
Kenneth Seseβ€’2y ago
Have you tried $this->record inside afterCreate()? I believe that returns the created model.
Prodex
ProdexOPβ€’2y ago
I haven't actually and it works. πŸ˜… I tried $record as parameter first, but that didn't work. Thank you!
Want results from more Discord servers?
Add your server