$extraAttributes Zusätzliche Spalten beim * Anlegen (z. B. OAuth-Provider). * @param string $channel Herkunft fürs Aktivitäts-Protokoll * ('magic-link' oder 'google'). */ public function provisionVerifiedCustomer(string $email, string $name, array $extraAttributes = [], string $channel = 'magic-link'): User { $user = User::create([ 'name' => $name !== '' ? $name : $email, 'email' => $email, 'registration_type' => RegistrationType::Company->value, 'is_active' => true, // Konto-Anlage ist hier immer nutzerinitiiert (Magic-Link-Anforderung // bzw. OAuth-Login) – der Zeitpunkt gilt als DSGVO-Einwilligung. 'gdpr_consent_at' => now(), ...$extraAttributes, ]); $user->forceFill(['email_verified_at' => now()])->save(); $this->roleSync->assignRoleAndSyncPermissions($user, 'customer'); $channelLabels = ['magic-link' => 'Magic-Link', 'google' => 'Google']; $this->activityLog->record( ActivityType::UserRegistered, sprintf('%s (%s) wurde registriert — %s.', $user->name, $user->email, $channelLabels[$channel] ?? $channel), user: $user, meta: ['way' => $channel], ); return $user; } }