Skip to content

Model Events

Laravel Revisor fires several Model Events for you hook into key publishing and versioning events.

All events are fired on the Draft record, and pass the relevant Published or Versioned record as an argument to your callback (if applicable).

Event listeners can be registered using static methods on the Model class. The method names correspond to the event name.

php
Page::published(function (Page $page, Page $publishedRecord) {
    ...
});

Publishing Events

EventDescription
publishingFired before publishing a Model
publishedFired after publishing a Model
unpublishingFired before unpublishing a Model
unpublishedFired after unpublishing a Model

Versioning Events

EventDescription
savingNewVersionFired before saving a new Version
savedNewVersionFired after saving a new Version
syncingToCurrentVersionFired before syncing to the current Version
syncedToCurrentVersionFired after syncing to the current Version
revertingToVersionFired before reverting to a Version
revertedToVersionFired after reverting to a Version