diff --git a/docs/v3.x/guides/slug.md b/docs/v3.x/guides/slug.md index 81aeeec298..7bf800b362 100644 --- a/docs/v3.x/guides/slug.md +++ b/docs/v3.x/guides/slug.md @@ -63,17 +63,15 @@ When it's done, you have to update the life cycle of the **Article** Content Typ const slugify = require('slugify'); module.exports = { - beforeSave: async model => { - if (model.title) { - model.slug = slugify(model.title); - } - }, - beforeUpdate: async model => { - if (model.getUpdate() && model.getUpdate().title) { - model.update({ - slug: slugify(model.getUpdate().title), - }); - } + lifecycles: { + beforeCreate: async (data) => { + if (data.title) { + data.slug = slugify(data.title); + } + }, + beforeUpdate: async (params, data) => { + data.slug = slugify(data.title); + }, }, }; ```