public function get_mutasi_siswa_rombel() { if (Request::ajax()) { $setting = Setting::first(); $awal = Input::get('tahun') . '-' . Input::get('awal'); $siswa = DB::table('siswa_rombel')->where('kd_rombel', '=', $awal)->join('siswa', 'siswa.nis', '=', 'siswa_rombel.nis'); $kode = Input::get('awal'); $kelas = Kelas::find($kode); //cari data kelas yang tingkatnya sama dengan data kelas sekarang $lain = DB::table('kelas')->where('kelas', '=', $kelas->kelas)->where('kd_kelas', '<>', $kode)->get(); return View::make('mutasi.siswa_rombel')->with('siswa', $siswa)->with('lain', $lain)->with('setting', $setting)->with('awal', $awal); } }
public function cari_tinggal_kelas() { if (Request::ajax()) { $setting = Setting::first(); $awal = Input::get('tahun') . '-' . Input::get('awal'); $siswa = DB::select("select a.*,c.* from siswa_rombel a,\n\t\t\tsiswa c where kd_rombel='{$awal}'\n\t\t\tand kd_rombel in(select b.kd_rombel from nilai_ujian b\n where b.kd_rombel=a.kd_rombel)\n and c.nis=a.nis"); $kelas = Kelas::find(Input::get('awal')); //cari data kelas yang tingkatnya sama dengan data kelas sekarang if ($kelas->kelas == '7') { $lain = DB::table('kelas')->where('kelas', '=', '8')->get(); } else { if ($kelas->kelas == '8') { $lain = DB::table('kelas')->where('kelas', '=', '9')->get(); } else { $lain = ""; } } if (count($siswa) > 0) { return View::make('kenaikan.get_siswa_tinggal')->with('siswa', $siswa)->with('awal', $awal)->with('setting', $setting)->with('lain', $lain); } else { echo "<div class='alert alert-danger'>Tidak ada data</div>"; } } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { // $kelas = Kelas::find($id); if ($kelas->delete()) { return response()->json(array('success' => TRUE)); } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $rombel = DB::table('rombel')->where('kd_kelas', '=', $id)->count(); if ($rombel > 0) { $html = "<hr><div class='alert alert-danger'>Kelas masih ada relasi dengan data Rombel : <ul>"; $data = DB::table('rombel')->where('kd_kelas', '=', $id)->get(); foreach ($data as $row) { $html .= "<li>" . $row->kd_rombel . "</li>"; } $html .= "</ul></div>"; Session::flash('pesan', $html); return Redirect::back(); } else { Kelas::find($id)->delete(); return Redirect::to('admin/kelas')->with('pesan', "<hr><div class='alert alert-info'>\n\t\t\t\t\tData Berhasil dihapus</div>"); } }