public function waktu_habis() { $siswa = $this->getSiswa(); $peserta = Peserta::where('nis', $siswa->nis)->first(); $jadwal = Session::get('jadwal'); $detailjadwal = Session::get('detailjadwal'); DB::table('soal_siswa')->where('id_jadwal', $jadwal)->where('id_detail_jadwal', $detailjadwal)->where('nis', $this->getNis())->update(['selesai' => 'Y']); Session::flash('pesan', "Terima Kasih anda telah menyelesaikan ujian"); Session::forget('jadwal'); Session::forget('detailjadwal'); return View('siswa.telah_selesai')->with('siswa', $siswa)->with('peserta', $peserta); }
public function cetak_peserta(Request $request) { $type = $request->input('type'); $idruang = $request->input('ruang'); $ruang = Ruang::find($idruang); $peserta = Peserta::where('id_ruang', $idruang)->get(); switch ($type) { case 'pdf': $data['ruang'] = Ruang::find($idruang); $data['peserta'] = Peserta::where('id_ruang', $idruang)->get(); $pdf = PDF::loadView('admin.laporan.cetak-peserta', $data); return $pdf->stream(); break; case 'excel': Excel::create('Data Peserta', function ($excel) use($ruang, $peserta) { //set properties $excel->setTitle('Data Peserta')->setCreator('Jamal Apriadi, S.Kom'); $excel->sheet('Laporan Nilai Siswa', function ($sheet) use($ruang, $peserta) { $row = 1; $sheet->row($row, array('NISN', 'No. Peserta', 'Nama', 'Kelas', 'Password')); foreach ($peserta as $s) { $sheet->row(++$row, array($s->nis, $s->siswa->no_peserta, $s->siswa->nama, $s->siswa->kd_kelas, $s->siswa->password_asli)); } }); })->export('xls'); break; default: # code... break; } }
public function atur_peserta($id) { $ruang = Ruang::find($id); $peserta = Peserta::where('id_ruang', $id)->get(); return View('admin.peserta.atur_peserta')->with('ruang', $ruang)->with('peserta', $peserta); }