Ad

How To Get RainLab Blog Plugin New Post Event?

- 1 answer

I use RainLab.Blog plugin on my site running OctoberCMS. I want to send mails to users in my database, whenever I make new post in my blog. I know that I can use Laravel Notifications , but can't figure out how to attach it to new post event, if there is any.

Ad

Answer

Use model events: https://octobercms.com/docs/database/model#events

You can use the Extend method on your model E.g: BlogNews::extend(function { ... }) and either use addDynamicMethod or implement a behaviour that has the event handler methods events you need.

Ad
source: stackoverflow.com
Ad