Ejemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $grup = new Grup();
     $grup->nama = Request::input('nama');
     $grup->kodekelas = Request::input('kelas');
     $grup->nim = Session::get('user');
     $grup->save();
     $last = Grup::orderBy('created_at', 'desc')->first();
     $member = new AnggotaGrup();
     $member->id_grup = $last->id;
     $member->nim = Request::input('nim');
     $member->kodekelas = Request::input('kelas');
     $member->save();
 }
 public function getData($id, $title, $kodeKelas, $kodeGrup)
 {
     $dateNow = Carbon::now();
     $kelasDosen = Perkuliahan::select('kodekelas')->where('nip', '=', $id)->get()->toArray();
     $kelasMhs = Mhskelas::select('kodekelas')->where('nim', '=', $id)->get()->toArray();
     $data = array('mahasiswaProfile' => Mahasiswa::with('dosenWali')->where('nim', '=', Request::segment(3))->first(), 'mahasiswa' => Mahasiswa::where('nim', '=', $id)->first(), 'dosenwali' => ['' => '-- Pilih dosen --'] + Dosen::lists('nama', 'nip'), 'kelas' => Mhskelas::with(array('mhs', 'perkuliahan', 'mk'))->where('nim', '=', $id)->get(), 'title' => $title, 'listPerkuliahan' => ['' => '-- Pilih kelas --'] + Mhskelas::select('matakuliah.namamk', 'mhskelas.kodekelas')->join('matakuliah', 'mhskelas.kodemk', '=', 'matakuliah.kodemk')->join('mahasiswa', 'mhskelas.nim', '=', 'mahasiswa.nim')->where('mahasiswa.nim', '=', $id)->lists('matakuliah.namamk', 'mhskelas.kodekelas'), 'grup' => AnggotaGrup::select('grup.nama', 'grup.kodekelas', 'grup.id')->join('grup', 'grup.id', '=', 'anggota_grup.id_grup')->where('anggota_grup.nim', '=', $id)->get(), 'kelasMember' => Mhskelas::with('mhs')->where('kodekelas', '=', $kodeKelas)->get(), 'infokelas' => Perkuliahan::with('mk', 'dosen')->where('kodekelas', '=', $kodeKelas)->first(), 'infoGrup' => Grup::with('mk', 'mhs')->where('id', '=', $kodeGrup)->first(), 'grupMember' => AnggotaGrup::with('mhs')->where('id_grup', '=', $kodeGrup)->get(), 'inviteNotifCount' => Notifikasi::with('mhs')->where('recepient', '=', $id)->get(), 'tugasDosen' => Tugas::where('pengumpulan', '>=', $dateNow)->whereIn('kelas', $kelasDosen)->get(), 'tugasMhs' => Tugas::where('pengumpulan', '>=', $dateNow)->whereIn('kelas', $kelasMhs)->get(), 'pengumumanDosen' => Pengumuman::where('waktuaktif', '>=', $dateNow)->whereIn('kodekelas', $kelasDosen)->get(), 'pengumumanMhs' => Pengumuman::where('waktuaktif', '>=', $dateNow)->whereIn('kodekelas', $kelasMhs)->get());
     return $data;
 }