@php use App\Models\Student; $student = $student ?? Student::with(['school','major'])->first(); $school = $student?->school; $major = $student?->major; $sample = [ 'Nama' => $student->full_name ?? 'Nama Siswa', 'NIS' => $student->nis ?? '123456', 'NISN' => $student->nisn ?? '654321', 'Kelas' => $student->class_name ?? 'XII-A', 'TTL' => ($student->birth_place ?: 'Kota') . ', ' . ($student->birth_date?->format('d M Y') ?? '01 Jan 2000'), 'Alamat Jalan' => $student->address_road ?? 'Jl. Mawar', 'RT' => $student->address_rt ?? '001', 'RW' => $student->address_rw ?? '002', 'Desa/Kel' => $student->address_village ?? 'Desa', 'Kecamatan' => $student->address_district ?? 'Kecamatan', 'Kota/Kab' => $student->address_city ?? 'Kota', 'Provinsi' => $student->address_province ?? 'Provinsi', 'Sekolah' => $school->name ?? 'Nama Sekolah', 'Jurusan' => $major->name ?? 'Jurusan', 'Nama Kepsek' => $school?->principal_name ?? 'Nama Kepala Sekolah', 'Dinas/Lembaga' => $school?->authority_name ?? 'Dinas Pendidikan', 'Telepon Sekolah' => $school?->phone ?? '08xxxx', 'Logo Sekolah' => $logoUrl ?? '', 'Tanda Tangan' => $signatureUrl ?? '', ]; @endphp @php $logoUrl = $school?->logo_path ? asset('storage/'.$school->logo_path) : null; $signatureUrl = $school?->principal_signature_path ? asset('storage/'.$school->principal_signature_path) : null; @endphp