rappasoft's avatar

Nova event when relationship is attached?

I've never used Nova before but I decided to take on a personal project with v4 to get familiar.

I have the need to send an email when a model is attached to a resource, i.e. a belongsToMany.

I know there are hooks when creating/updating the parent resource, but is there a Nova specific way to hook into when a child is attached?

I tried to use a third-party package that added these relationship events, but I couldn't seem to get it to work.

Thanks in advance.

0 likes
4 replies
mabdullahsari's avatar

Nova is great until you need to carry out the smallest of custom actions / behavior invocations.

The answer is unfortunately no. You'll need those 3rd party packages.

Nova is nothing but a CRUD panel. If you need to do something other than CRUD, the other options might suit you best.

2 likes
clevyr's avatar

I was able to make this work by creating a custom pivot model, specifying it on the parent relationships with ->using(CustomPivot::class) and then observing the pivot model created/updated/deleted events.

Please or to participate in this conversation.