@php $school = $student->school; $major = $student->major; $dob = $student->birth_date ? $student->birth_date->format('d M Y') : '-'; $photoUrl = $student->photo_path ? asset('storage/' . $student->photo_path) : null; $logo = $school?->logo_path ? asset('storage/' . $school->logo_path) : ($school?->logo_left_path ? asset('storage/' . $school->logo_left_path) : ($school?->logo_right_path ? asset('storage/' . $school->logo_right_path) : null)); $signature = $school?->principal_signature_path ? asset('storage/' . $school->principal_signature_path) : null; $initials = collect(explode(' ', $student->full_name))->filter()->map(fn ($p) => strtoupper(substr($p, 0, 1)))->take(2)->implode(''); $addressParts = array_filter([ $student->address_road, implode(' / ', array_filter([$student->address_rt ? 'RT ' . $student->address_rt : null, $student->address_rw ? 'RW ' . $student->address_rw : null])), $student->address_village, $student->address_district, $student->address_city, $student->address_province, ]); $address = count($addressParts) ? implode(', ', array_filter($addressParts)) : '-'; $qrData = $student->full_name . ' | ' . ($student->birth_place ?: '-') . ', ' . $dob . ' | ' . ($student->gender ?: '-'); $schoolGmap = $school?->gmap_link; $attendanceCode = $student->nis ?: $student->nisn ?: null; $attendanceBarcode = $attendanceCode ? 'https://bwipjs-api.metafloor.com/?bcid=code128&scale=2&includetext&text=' . urlencode($attendanceCode) : null; @endphp