add test batches

This commit is contained in:
root
2026-06-08 23:45:55 -04:00
parent c792b8be05
commit 8d4d610b82
1480 changed files with 22587 additions and 10762 deletions
@@ -14,13 +14,9 @@ use Illuminate\Http\Request;
class CommunicationController extends BaseApiController
{
private CommunicationStudentService $students;
private CommunicationTemplateService $templates;
private CommunicationFamilyService $families;
private CommunicationPreviewService $previewService;
private CommunicationSendService $sendService;
public function __construct(
@@ -80,7 +76,7 @@ class CommunicationController extends BaseApiController
$teacherName = $this->resolveTeacherName();
$result = $this->previewService->buildPreview($templateKey, $studentId, $familyId, $vars, $teacherName);
if (! $result['ok']) {
if (!$result['ok']) {
return response()->json([
'ok' => false,
'message' => $result['message'] ?? 'Preview failed.',
@@ -120,7 +116,7 @@ class CommunicationController extends BaseApiController
}
$student = $this->students->getStudentBasic($studentId);
if (! $student) {
if (!$student) {
return response()->json([
'ok' => false,
'message' => 'Student not found.',
@@ -141,11 +137,11 @@ class CommunicationController extends BaseApiController
'recipients' => $recipients,
'cc' => $cc,
'bcc' => $bcc,
'student_name' => trim(($student['firstname'] ?? '').' '.($student['lastname'] ?? '')),
'student_name' => trim(($student['firstname'] ?? '') . ' ' . ($student['lastname'] ?? '')),
'sent_by' => $senderId,
]);
if (! $result['ok']) {
if (!$result['ok']) {
return response()->json([
'ok' => false,
'message' => 'Failed to send email.',
@@ -179,14 +175,15 @@ class CommunicationController extends BaseApiController
{
$user = auth()->user();
if ($user) {
$name = trim(($user->firstname ?? '').' '.($user->lastname ?? ''));
$name = trim(($user->firstname ?? '') . ' ' . ($user->lastname ?? ''));
return $name !== '' ? $name : 'Teacher';
}
return 'Teacher';
}
/**
* @return int|JsonResponse
*/
private function authenticatedUserIdOrUnauthorized(): int|JsonResponse
{
$userId = (int) (auth()->id() ?? 0);