update controllers logic

This commit is contained in:
root
2026-04-23 00:04:35 -04:00
parent 1977a513df
commit ca4ba272fc
353 changed files with 13402 additions and 1301 deletions
+8 -19
View File
@@ -7,6 +7,7 @@ use App\Models\ParentModel;
use App\Models\Role;
use App\Models\User;
use App\Models\UserRole;
use App\Services\ApplicationUrlService;
use App\Services\EmailService;
use App\Services\SchoolIdService;
use Illuminate\Support\Facades\DB;
@@ -17,7 +18,8 @@ class RegistrationService
private EmailService $emailService,
private SchoolIdService $schoolIdService,
private RegistrationFormatterService $formatter,
private RegistrationCaptchaService $captchaService
private RegistrationCaptchaService $captchaService,
private ApplicationUrlService $urls,
) {
}
@@ -125,26 +127,13 @@ class RegistrationService
}
});
$activationLink = url('/user/confirm/' . $token);
$activationLink = $this->urls->spaRegistrationConfirmUrl($token);
$recipientName = trim((string) ($formatted['firstname'] ?? '') . ' ' . (string) ($formatted['lastname'] ?? ''));
$emailData = [
'recipientName' => $recipientName,
'activationLink' => $activationLink,
'orgName' => 'Al Rahma Sunday School',
'contactInfo' => 'alrahma.isgl@gmail.com',
'logoUrl' => 'https://alrahmaisgl.org/assets/images/alrahma_logo.png',
'subject' => 'Email Confirmation',
];
if (view()->exists($isParent ? 'emails.welcome_parent' : 'emails.welcome_staff')) {
$html = view($isParent ? 'emails.welcome_parent' : 'emails.welcome_staff', $emailData);
} else {
$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();