Hi!, I’d like to know if there’s an event or something that fires whenever ANY model (tailor and regular) is saved (modified or created) or even sorted? For a particular case I’m implementing a site’s frontend with Next.js and I want to hit a revalidate cache url whenever info on the OC backend changes.
\October\Rain\Database\Model::extend(function ($model) {
$model->bindEvent('model.afterSave', function () use ($model) {
if ($model->isDirty() || $model->wasRecentlyCreated) {
\Http::get($cleanCacheUrl);
}
});
});
1 Like