This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

TerjeN
TerjeN

I want to run a function whenever I add or update a post using the plugin i made with plugin builder, in the backend.

I made one model called Events and one called Logs. If i go to the backend and and create an Event, i want log what i just did, and put an entry in the Logs model of what Event i made, wich Backenduser made it, etc.

Where is the function that saves my Events? Or how should i approach this?

Last updated

TerjeN
TerjeN

Or, where can I find the function that saves / updates my Model? When that model is made by builder plugin ?

JeffGoldblum
JeffGoldblum

Look into the Model events: https://octobercms.com/docs/api/model/aftersave. You can also look at using my plugin for audit logging: https://octobercms.com/plugin/luketowers-easyaudit

TerjeN
TerjeN

Perfect, Luke! Thank you very much, worked first try and learned alot from it.

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.