Which event should I listen to for creating or updating

I’m trying to add an event listener to create a custom slug before a model is created or updated (in the backend). However, it seems like my event doesn’t fire. I’ve tried a few different events, but I find the documentation a bit confusing on this point.

public function boot()
    {
            Event::listen('backend.form.beforeCreate', LinusBostrom\Gasrundan\Observers\RaceSlugObserver::class);
            Event::listen('backend.form.beforeUpdate', LinusBostrom\Gasrundan\Observers\RaceSlugObserver::class);
    }

Hey @linusb

Take a look at the extending models documentation for an example:

Thank you @daft for taking the time to reply!

According to the documentation, there should be an event named model.beforeSave that fires on both create and update. Didn’t manage to subscribe to the event in my plugin.php file though, instead I ended up using beforeSave as a function in the model, and I (finally!) got the desired result.