-
-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to create slug from title or slug field #272
Comments
Well you can do this, as i did public function sluggable()
{
return [
'slug' => [
'source' => ! empty($this->slug) ? 'slug' : 'title'
]
];
} But the problem is that the package doesn't support having the source and destination field the same. |
Again, I'm not sure why you want to create a slug from a slug field. If you did The package won't slug a model if the destination attribute has a value. This is to prevent slugs from constantly being calculated (and possibly overwritten) in cases where they shouldn't be. You don't want your post URLs changing randomly, right? ;) If you want to regenerated a slug field from the source, set See #270 for more discussion on source and dest fields being the same. I'm still not convinced this is a use-case for the package (but I'm happy to review a PR that adds that functionality). |
Hello,
I want automatic create slug from title or slug field. How to config it?
The text was updated successfully, but these errors were encountered: