-
-
Notifications
You must be signed in to change notification settings - Fork 188
How to update 'slug' during update? #253
gundogduyakici
started this conversation in
General
-
Hello,
Any problem if you add the post but I also want to have it when I update. (for some pages). How can we make this situation? What needs to be done in the model file? Is there a method for this? Below are the codes in my model file;
public function getSlugOptions() : SlugOptions
{
return SlugOptions::create()
->generateSlugsFrom('name')
->saveSlugsTo('slug')
->usingLanguage('de');
}
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 1 reply
-
Hello @gundogduyakici , did you find a solution to this
Beta Was this translation helpful? Give feedback.
All reactions
1 reply
-
UPDATE:
I used $model->generateSlug() to generate the slug and then did the update
Check it out here
https://github.com/spatie/laravel-sluggable#regenerating-slugs
Beta Was this translation helpful? Give feedback.
All reactions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment