Lifecycle Hooks on simple resources

Where do I apply these?
In the documentation it says:
You can use the before() and after() methods to execute code before and after a record is deleted:

DeleteAction::make()
->before(function () {
// ...
})
->after(function () {
// ...
})

But where does this code go?
In the page resource?
For the edit life cycle hook it says:
"To set up a hook, create a protected method on the Edit page class with the name of the hook:"

I'm using a simple resource (modal editing only, so doesn't have an edit page?). Is this not possible, or is there another place to utilise the life cycle hooks for this case?
Was this page helpful?