fix gitlab tests

This commit is contained in:
root
2026-06-09 02:32:58 -04:00
parent 20a0b6c4e5
commit 6def9993da
1489 changed files with 10449 additions and 11356 deletions
@@ -10,7 +10,8 @@ class DefaultAttendanceMailerService implements AttendanceMailerService
public function __construct(
protected EmailService $emailService,
protected AttendanceEmailComposerService $emailComposerService
) {}
) {
}
public function send(string $to, string $subject, string $html): bool
{
@@ -25,24 +26,24 @@ class DefaultAttendanceMailerService implements AttendanceMailerService
}
$student = (array) ($payload['student'] ?? []);
$studentName = trim((string) ($student['firstname'] ?? '').' '.(string) ($student['lastname'] ?? ''));
$studentName = trim((string) ($student['firstname'] ?? '') . ' ' . (string) ($student['lastname'] ?? ''));
$subjectType = (string) ($payload['subject'] ?? 'Attendance');
$date = substr((string) ($payload['date'] ?? now()->toDateString()), 0, 10);
$subject = "Attendance Notice: {$subjectType}";
$body = '<p>Dear '.e((string) data_get($payload, 'parent.name', 'Parent/Guardian')).',</p>'
.'<p>This is an attendance notification for your student.</p>'
.'<ul>'
.'<li><strong>Student:</strong> '.e($studentName !== '' ? $studentName : 'Student').'</li>'
.'<li><strong>Date:</strong> '.e($date).'</li>'
.'<li><strong>Attendance:</strong> '.e($subjectType).'</li>'
.'</ul>'
.'<p>If you have any questions, please contact the school office.</p>';
$body = '<p>Dear ' . e((string) data_get($payload, 'parent.name', 'Parent/Guardian')) . ',</p>'
. '<p>This is an attendance notification for your student.</p>'
. '<ul>'
. '<li><strong>Student:</strong> ' . e($studentName !== '' ? $studentName : 'Student') . '</li>'
. '<li><strong>Date:</strong> ' . e($date) . '</li>'
. '<li><strong>Attendance:</strong> ' . e($subjectType) . '</li>'
. '</ul>'
. '<p>If you have any questions, please contact the school office.</p>';
$html = $this->emailComposerService->renderWithEmailLayout($subject, $body);
if (! $this->send($to, $subject, $html)) {
Log::error('Attendance notification email failed for '.$to);
if (!$this->send($to, $subject, $html)) {
Log::error('Attendance notification email failed for ' . $to);
throw new \RuntimeException('Failed to send attendance notification email.');
}
}