F
Filament16mo ago
Macklin

unique field erroring on update

Having issues with the unqiue constraint requiring the field to be unique, even on updating. It should only be unique if it is being changed to something different or while being created, not when it is unchanged.
Forms\Components\Fieldset::make('Route')
->relationship('route')
->schema([
Forms\Components\TextInput::make('title'),
Forms\Components\TextInput::make('slug')->unique(),
Forms\Components\TextInput::make('old_slug')->unique(),
])
Forms\Components\Fieldset::make('Route')
->relationship('route')
->schema([
Forms\Components\TextInput::make('title'),
Forms\Components\TextInput::make('slug')->unique(),
Forms\Components\TextInput::make('old_slug')->unique(),
])
Solution:
Just like normal laravel you have to tell it it ignore itself. Example from the docs. Field::make('email')->unique(ignorable: $ignoredUser)...
Jump to solution
2 Replies
Solution
awcodes
awcodes16mo ago
Just like normal laravel you have to tell it it ignore itself. Example from the docs. Field::make('email')->unique(ignorable: $ignoredUser)
Macklin
MacklinOP16mo ago
thank you, I was able to use ignoreRecord: true, sorry I missed this part of the documentation!
Want results from more Discord servers?
Add your server