Mise à jour de models
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
|
||||
const slug = require("slug");
|
||||
const slugify = require("slugify");
|
||||
|
||||
const {
|
||||
Model
|
||||
@@ -31,7 +31,7 @@ module.exports = (sequelize, DataTypes) => {
|
||||
});
|
||||
|
||||
Article.beforeValidate((article) => {
|
||||
article.slug = slug(article.title) + '-' + (Math.random() * Math.pow(36, 6) | 0).toString(36);
|
||||
article.slug = slugify(article.title, { lower: true });
|
||||
});
|
||||
|
||||
Article.prototype.toJSONFor = function () {
|
||||
|
||||
Reference in New Issue
Block a user