/** * Show the form for creating a new resource. * * @return Response */ public function apiSiswa($id = NULL) { // $data = Siswa::with('kelas')->where('id_kelas', '=', $id)->orderBy('nis')->get(); return response()->json($data); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show(AbsensiRequest $request) { // $input = $request->except('_token'); $data['title'] = 'Lihat Absensi'; $data['fulltanggal'] = date('d F Y', strtotime($input['tanggal'] . '-' . $input['bulan'] . '-' . $input['tahun'])); $data['siswa'] = Siswa::with(['absensi' => function ($query) use($input) { $query->where('tanggal', '=', $input['tanggal'])->where('bulan', '=', $input['bulan'])->where('tahun', '=', $input['tahun']); }])->where('id_kelas', '=', $input['kelas'])->get(); if ($this->auth->user()->status == 'admin') { return View('backend.absensi.show', $data); } return View('guru.absensi.show', $data); }