feat: update student import and graduation workflows

This commit is contained in:
2026-04-30 00:04:52 +07:00
parent 189b076ab0
commit ac22f8b7c8
51 changed files with 4547 additions and 1287 deletions
@@ -144,12 +144,20 @@ class PublicStudentLookupController extends Controller
public function downloadGraduationDocument(Student $student, string $document): StreamedResponse
{
abort_unless($student->status === 'graduated', 404);
abort_unless(in_array($document, ['skl', 'ijazah'], true), 404);
abort_unless(in_array($document, ['skl', 'ijazah', 'transcript', 'ukk-certificate', 'lsp-certificate'], true), 404);
$graduation = StudentGraduation::query()->where('student_id', $student->id)->firstOrFail();
$filePathField = $document === 'skl' ? 'skl_file_path' : 'ijazah_file_path';
$fileNameField = $document === 'skl' ? 'skl_file_name' : 'ijazah_file_name';
$documentConfig = [
'skl' => ['path' => 'skl_file_path', 'name' => 'skl_file_name'],
'ijazah' => ['path' => 'ijazah_file_path', 'name' => 'ijazah_file_name'],
'transcript' => ['path' => 'transcript_file_path', 'name' => 'transcript_file_name'],
'ukk-certificate' => ['path' => 'ukk_certificate_file_path', 'name' => 'ukk_certificate_file_name'],
'lsp-certificate' => ['path' => 'lsp_certificate_file_path', 'name' => 'lsp_certificate_file_name'],
][$document];
$filePathField = $documentConfig['path'];
$fileNameField = $documentConfig['name'];
abort_unless($graduation->{$filePathField} && Storage::disk('public')->exists($graduation->{$filePathField}), 404);