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

Feature: Add the ability to specify how slugs are generated #277

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

RVxLab
Copy link
Collaborator

@RVxLab RVxLab commented Feb 19, 2023

Closes #249 and #275.

This PR adds the ability to specify how slugs are generated. It's mainly targeted to non-Latin alphabet developers who otherwise need to use ASCII characters (or anything that can fit in Str::slug) in order for tabs to work.

Unfortunately, due to a missing Nova 4 license, I'm unable to test this in an application. I did write some unit tests to hopefully cover for this. However, again due to a missing license, I'm unable to properly run those.

Some help will be needed to verify this is working.

@imnpc
Copy link

imnpc commented Aug 19, 2023

use Chinese test ok on Nova 3 and Nova 4

1.app/Providers/NovaServiceProvider.php

    public function boot()
    {
        parent::boot();
        Tab::createSlugUsing(fn (Tab $tab) => $tab->getTitle()); //  add this line
     }

2.app/Nova/User.php

            Tabs::make('Relations', [
                Tab::make(__('Project'), [
                    HasMany::make('Project')
                ]),
            ]),

OR

            Tabs::make('Relations', [
                Tab::make('项目'), [
                    HasMany::make('Project')
                ]),
            ]),

@RVxLab
Copy link
Collaborator Author

RVxLab commented Aug 19, 2023

use Chinese test ok on Nova 3 and Nova 4

1.app/Providers/NovaServiceProvider.php

    public function boot()
    {
        parent::boot();
        Tab::createSlugUsing(fn (Tab $tab) => $tab->getTitle()); //  add this line
     }

2.app/Nova/User.php

            Tabs::make('Relations', [
                Tab::make(__('Project'), [
                    HasMany::make('Project')
                ]),
            ]),

OR

            Tabs::make('Relations', [
                Tab::make('项目'), [
                    HasMany::make('Project')
                ]),
            ]),

Thank for your testing this in an application!

@marcfilipan Would you accept this as a testcase?

@marcfil marcfil merged commit 2d17ad1 into eminiarts:master Sep 9, 2024
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

Successfully merging this pull request may close these issues.

Proposal: slug customization
3 participants