如何获取 RainLab 博客插件新 post 事件?

How to get RainLab Blog plugin new post event?

我在我的站点 运行 OctoberCMS 上使用 RainLab.Blog 插件。每当我在我的博客中创建新 post 时,我想向我数据库中的用户发送邮件。我知道我可以使用 Laravel Notifications ,但不知道如何将它附加到 new post 事件,如果有的话。

使用模型事件: https://octobercms.com/docs/database/model#events

您可以在您的模型上使用 Extend 方法,例如:BlogNews::extend(function { ... }) 并使用 addDynamicMethod 或实现具有您需要的事件处理程序方法事件的行为。