tomhatzer / nova-slug-field

Slug field for Laravel Nova

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nova 4.0

gsusanj opened this issue · comments

Hey, any chance to update this package to Nova 4.0?
The issue is the TextWithSlug field does not show up on any screen.

Hi There, any update on this?

In the meanwhile you could use the new native depensOn to create a replacement for the functionality of this package:

Text::make(__('Name'), 'name'),

Text::make(__('Slug'), 'slug')
    ->dependsOn(
        ['name'],
        function(Text $field, NovaRequest $request, FormData $formData) {
            if ($formData->name <> optional($request->resource()::find($request->resourceId))->name) {
                $field->value = Str::slug($formData->name);
                $field->help(config('app.url') . '/categories/' . $field->value);
            }
        }
    ),

Hi all!

I don't have a nova 4 license yet, so am not able to test it.
If anyone wants to provide a PR, you are very welcome to.

Thank you very much and have a great day!

@sanderbaas That example doesn't work as I would expect NovaSlugField works but thanks for the snippet
@tomhatzer did you get a license?

@tomhatzer I just openend a PR that works well.

@tomhatzer any update on that PR? 🤔

@juergenZeindlinger if you can test it and can confirm that it works I‘m willing to approve and merge it :) I don‘t work with Nova anymore and don‘t have a license for v4.

@tomhatzer I can't but @jmverges mentioned that his PR works well 🤔 Don't know

I think this functionality is now part of Nova 4: https://nova.laravel.com/docs/4.0/resources/fields.html#slug-field

Thanks for that, yep Nova 4 supports 95% of the functionality of this package out of the box. The only differences I can see are that disableAutoUpdateWhenUpdating is enabled by default, with no way to turn it off (I prefer it enabled anyways). And the slug generation is debounced and not as responsive, but I can live with that.

Anyways thank you to the maintainers of this package for providing it for Nova 3 for many years 🙏🏼