Skip to content

Translatable slugs #18

Description

@sanneterpstra

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.

Activity

  1. amad commented on May 25, 2020

    @amad

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions