Fix Laravel Pint formatting
This commit is contained in:
@@ -20,13 +20,12 @@ class RegistrationService
|
||||
private RegistrationFormatterService $formatter,
|
||||
private RegistrationCaptchaService $captchaService,
|
||||
private ApplicationUrlService $urls,
|
||||
) {
|
||||
}
|
||||
) {}
|
||||
|
||||
public function register(array $payload): array
|
||||
{
|
||||
$captcha = (string) ($payload['captcha'] ?? '');
|
||||
if (!$this->captchaService->verify($captcha)) {
|
||||
if (! $this->captchaService->verify($captcha)) {
|
||||
return [
|
||||
'ok' => false,
|
||||
'code' => 'captcha_invalid',
|
||||
@@ -34,15 +33,15 @@ class RegistrationService
|
||||
];
|
||||
}
|
||||
|
||||
$isParent = !empty($payload['is_parent']);
|
||||
$noSecondInfo = !empty($payload['no_second_parent_info']);
|
||||
$isParent = ! empty($payload['is_parent']);
|
||||
$noSecondInfo = ! empty($payload['no_second_parent_info']);
|
||||
|
||||
$formatted = $this->formatter->format($payload);
|
||||
$email = (string) ($formatted['email'] ?? '');
|
||||
|
||||
$existing = User::query()->where('email', $email)->first();
|
||||
if ($existing) {
|
||||
$pending = !empty($existing->token) && (int) ($existing->is_verified ?? 0) === 0;
|
||||
$pending = ! empty($existing->token) && (int) ($existing->is_verified ?? 0) === 0;
|
||||
if ($pending) {
|
||||
return [
|
||||
'ok' => false,
|
||||
@@ -60,7 +59,7 @@ class RegistrationService
|
||||
|
||||
$roleName = $isParent ? 'parent' : 'guest';
|
||||
$role = Role::query()->where('name', $roleName)->first();
|
||||
if (!$role) {
|
||||
if (! $role) {
|
||||
return [
|
||||
'ok' => false,
|
||||
'code' => 'role_missing',
|
||||
@@ -113,7 +112,7 @@ class RegistrationService
|
||||
'created_at' => now(),
|
||||
]);
|
||||
|
||||
if ($isParent && !$noSecondInfo && !empty($formatted['second_firstname'])) {
|
||||
if ($isParent && ! $noSecondInfo && ! empty($formatted['second_firstname'])) {
|
||||
ParentModel::query()->create([
|
||||
'secondparent_firstname' => $formatted['second_firstname'] ?? null,
|
||||
'secondparent_lastname' => $formatted['second_lastname'] ?? null,
|
||||
@@ -128,12 +127,12 @@ class RegistrationService
|
||||
});
|
||||
|
||||
$activationLink = $this->urls->spaRegistrationConfirmUrl($token);
|
||||
$recipientName = trim((string) ($formatted['firstname'] ?? '') . ' ' . (string) ($formatted['lastname'] ?? ''));
|
||||
$recipientName = trim((string) ($formatted['firstname'] ?? '').' '.(string) ($formatted['lastname'] ?? ''));
|
||||
|
||||
$html = '<p>Hello ' . e($recipientName !== '' ? $recipientName : 'there') . ',</p>'
|
||||
. '<p>Please confirm your email by clicking the link below:</p>'
|
||||
. '<p><a href="' . e($activationLink) . '">Activate your account</a></p>'
|
||||
. '<p>Thank you.</p>';
|
||||
$html = '<p>Hello '.e($recipientName !== '' ? $recipientName : 'there').',</p>'
|
||||
.'<p>Please confirm your email by clicking the link below:</p>'
|
||||
.'<p><a href="'.e($activationLink).'">Activate your account</a></p>'
|
||||
.'<p>Thank you.</p>';
|
||||
|
||||
$sent = $this->emailService->send($email, 'Email Confirmation', $html, 'general');
|
||||
$this->captchaService->clear();
|
||||
|
||||
Reference in New Issue
Block a user