add all controllers logic

This commit is contained in:
root
2026-03-11 17:53:15 -04:00
parent 3e6c577085
commit 2ef71cc92b
421 changed files with 12009 additions and 5211 deletions
@@ -0,0 +1,32 @@
<?php
namespace App\Services\ClassSections;
use App\Models\ClassSection;
use App\Models\Configuration;
use App\Models\Student;
use App\Models\User;
class ClassAttendanceService
{
public function getAttendancePayload(int $classSectionId, int $teacherId, ?string $schoolYear = null, ?string $semester = null): array
{
$schoolYear = $schoolYear ?: (string) (Configuration::getConfig('school_year') ?? '');
$semester = $semester ?: (string) (Configuration::getConfig('semester') ?? '');
$teacher = User::query()->find($teacherId);
$teacherName = trim((string) ($teacher?->firstname ?? '') . ' ' . (string) ($teacher?->lastname ?? ''));
$className = ClassSection::getClassSectionNameBySectionId($classSectionId) ?? (string) $classSectionId;
$students = Student::getStudentInfoByClassSectionId($classSectionId, $semester, $schoolYear, $teacherId);
return [
'teacher_name' => $teacherName,
'class_name' => $className,
'class_section_id' => $classSectionId,
'semester' => $semester,
'school_year' => $schoolYear,
'students' => $students,
];
}
}