Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to update 'slug' during update? #253

gundogduyakici started this conversation in General
Discussion options

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');
}
You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

Hello @gundogduyakici , did you find a solution to this

You must be logged in to vote
1 reply
Comment options

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /