class UserImporter extends Importer
{
protected static ?string $model = User::class;
public static function getColumns(): array
{
return [
[...]
];
}
protected function beforeSave(): void
{
[...]
}
protected function afterSave(): void
{
[...]
Notification::make()
->title(__('filament.invitation_transmitted') . $user->first_name . ' ' . $user->last_name . '.')
->success()
->duration(10000)
->send();
}
public function resolveRecord(): ?User
{
$user = User::query()
->where('email', $this->data['email'])
->first();
if ($user) {
Notification::make()
->title($user->email . __('filament.already_registered'))
->success()
->duration(10000)
->send();
throw new RowImportFailedException(__('filament.already_registred') . "[{$this->data['email']}].");
}
return new User();
}
public static function getCompletedNotificationBody(Import $import): string
{
[...]
return $body;
}
}
class UserImporter extends Importer
{
protected static ?string $model = User::class;
public static function getColumns(): array
{
return [
[...]
];
}
protected function beforeSave(): void
{
[...]
}
protected function afterSave(): void
{
[...]
Notification::make()
->title(__('filament.invitation_transmitted') . $user->first_name . ' ' . $user->last_name . '.')
->success()
->duration(10000)
->send();
}
public function resolveRecord(): ?User
{
$user = User::query()
->where('email', $this->data['email'])
->first();
if ($user) {
Notification::make()
->title($user->email . __('filament.already_registered'))
->success()
->duration(10000)
->send();
throw new RowImportFailedException(__('filament.already_registred') . "[{$this->data['email']}].");
}
return new User();
}
public static function getCompletedNotificationBody(Import $import): string
{
[...]
return $body;
}
}