Filament Importer skip import row if certain conditions is true

I create a simple importer that import only one column "email".
The importer works properly, now i try to stop import row if email has already been imported

I try to use beforeValidate hooks, but it doesn't seem to work.

alternative to $this->action->halt(); ???

thank you always for your availability

protected function beforeValidate(): void 
    {
        $user = User::where('email', $this->data['email'])->first();
            if ($user) {
                Notification::make()
                    ->danger()
                    ->title('User already exist')
                    ->body('This email has already been used for a user on the platform')
                    ->persistent()
                    ->send();

                $this->action->halt();
            }
    }
Solution
ok its worked, i add the code in public function resolveRecord() function and use Filament\Actions\Imports\Exceptions\RowImportFailedException;
image.png
Was this page helpful?