Skip to content
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

Translatable slugs #18

Open
sanneterpstra opened this issue Feb 18, 2020 · 1 comment
Open

Translatable slugs #18

sanneterpstra opened this issue Feb 18, 2020 · 1 comment

Comments

@sanneterpstra
Copy link

Is there an easy way to implement translatable slugs? I'm using the optimistdigital/nova-translatable package but this gives me an error on the keyup event.

@amad
Copy link

amad commented May 25, 2020

spatie/laravel-translatable stores everything in JSON field. So you must use that JSON field to generate slug from on your model.

public function getSlugOptions(): SlugOptions
{
    return SlugOptions::create()
        ->generateSlugsFrom('name->en')
        ->saveSlugsTo('slug');
}

I haven't tried optimistdigital/nova-translatable and I don't know how it wraps native fields. So you have to try that yourself. But, I know it works with spatie/nova-translatable package.

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

No branches or pull requests

2 participants