© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
5 replies
einnlleinhatt_

Edit not working

I am going through a tutorial and have watched the same video a few times to see if I had incorrect syntax on my form, but to me it looked ok. But when I hit 'edit' and then click save changes I get an error that the value already exists. This is happening on each of the forms I created.

public static function form(Form $form): Form
    {
        return $form
            ->schema([
                Group::make()
                ->schema([
                    Section::make()
                    ->schema([
                        TextInput::make('name')
                            ->required()
                            ->live(onBlur:true)
                            ->unique()
                            ->afterStateUpdated(function(string $operation, $state, Forms\Set $set){
                                    if($operation!=='create'){
                                        return;
                                    }
                                $set('slug', Str::slug($state));

                            })
                   
            ])
            ]);
    }
public static function form(Form $form): Form
    {
        return $form
            ->schema([
                Group::make()
                ->schema([
                    Section::make()
                    ->schema([
                        TextInput::make('name')
                            ->required()
                            ->live(onBlur:true)
                            ->unique()
                            ->afterStateUpdated(function(string $operation, $state, Forms\Set $set){
                                    if($operation!=='create'){
                                        return;
                                    }
                                $set('slug', Str::slug($state));

                            })
                   
            ])
            ]);
    }
Solution
Because you have
->unique()
->unique()
validation, you have to provide like
->unique(ignoreRecord: true)
->unique(ignoreRecord: true)
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

CheckboxList not working on Edit
FilamentFFilament / ❓┊help
15mo ago
Edit modal action not working
FilamentFFilament / ❓┊help
2y ago
Edit not working in relation manager.
FilamentFFilament / ❓┊help
3y ago
unique() is not working in edit ?
FilamentFFilament / ❓┊help
3y ago