F
Filament3mo ago
Gaurav

How to specify ignoreRecord in unique rule in Import?

I've added an import action to a model with option to update existing record via firstOrNew method. Now, I wish to have the unique rule applied on a column, but only when the record is not being updated with the same value. Typical laravel way for this is to ignore record with matching id. However, how do I specify this in the rules() parameter for a column in getColumns method of an Importer?
2 Replies
Albert Lens
Albert Lens3mo ago
->unique(ignoreRecord: true) ?
Gaurav
Gaurav3mo ago
Method Filament\Actions\Imports\ImportColumn::unique does not exist.