© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
6 replies
raheel3031

slug is not generated within createOptionForm

slug is not generated within createOptionForm

Forms\Components\TextInput::make(name: 'name')
                                                                    ->required()
                                                                    ->maxlength(255)
                                                                    ->live(onBlur: true)
                                                                    ->unique(ignoreRecord: true)
                                                                    ->afterStateUpdated(function(string $operation, $state, Forms\Set $set) 
                                                                    {                                        
                                                                        if($operation !== 'create') {
                                                                            return;
                                                                        }
                                                                        $set('slug', Str::slug($state));
                                                                    }),

                                                                Forms\Components\TextInput::make(name: 'slug')
                                                                    ->disabled()
                                                                    ->dehydrated()
                                                                    ->required()
                                                                    ->maxlength(255)
                                                                    ->unique(table: Category::class, column: 'slug', ignoreRecord: true),
Forms\Components\TextInput::make(name: 'name')
                                                                    ->required()
                                                                    ->maxlength(255)
                                                                    ->live(onBlur: true)
                                                                    ->unique(ignoreRecord: true)
                                                                    ->afterStateUpdated(function(string $operation, $state, Forms\Set $set) 
                                                                    {                                        
                                                                        if($operation !== 'create') {
                                                                            return;
                                                                        }
                                                                        $set('slug', Str::slug($state));
                                                                    }),

                                                                Forms\Components\TextInput::make(name: 'slug')
                                                                    ->disabled()
                                                                    ->dehydrated()
                                                                    ->required()
                                                                    ->maxlength(255)
                                                                    ->unique(table: Category::class, column: 'slug', ignoreRecord: true),


How do I solve this?
image.png
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

CreateOptionForm is not showing
FilamentFFilament / ❓┊help
3y ago
CreateOptionForm is not showing
FilamentFFilament / ❓┊help
3y ago
Testing createOptionForm within an action
FilamentFFilament / ❓┊help
5mo ago
Accessing variables from within createOptionForm
FilamentFFilament / ❓┊help
3y ago