Skip to content
Discussion options

You must be logged in to vote

Hi @xinyou-app,

I don't know if there's a better way to do it, but here's a quick example to limit the number of revisions for a given module. You can add the following to your module repository :

    const MAX_REVISIONS = 4;

    public function afterSave($object, $fields)
    {
        parent::afterSave($object, $fields);

        $object->refresh()->revisions->slice(self::MAX_REVISIONS)->each->delete();
    }

This was not tested extensively but I hope it can be helpful!

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@xinyou-app
Comment options

Answer selected by xinyou-app
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants