/** * Run the database seeds. * * @return void */ public function run() { DB::table('mahasiswa')->delete(); DB::table('wali')->delete(); DB::table('dosen')->delete(); DB::table('hobi')->delete(); DB::table('mahasiswa_hobi')->delete(); $dosen = Dosen::create(array('nama' => 'Fazma Arif', 'nipd' => '1234567890')); $this->command->info('Data dosen telah diisi!'); $puji = Mahasiswa::create(array('nama' => 'Puji Muharani', 'nim' => '1103120133', 'id_dosen' => $dosen->id)); $aul = Mahasiswa::create(array('nama' => 'Aulia Marchita', 'nim' => '1103120264', 'id_dosen' => $dosen->id)); $ganin = Mahasiswa::create(array('nama' => 'Ganine Vinanda', 'nim' => '1103124321', 'id_dosen' => $dosen->id)); $this->command->info('Mahasiswa telah diisi!'); Wali::create(array('nama' => 'Bedy Purnama', 'id_mahasiswa' => $puji->id)); Wali::create(array('nama' => 'Tjokorda', 'id_mahasiswa' => $aul->id)); Wali::create(array('nama' => 'Fatimah Arum', 'id_mahasiswa' => $ganin->id)); $this->command->info('Data mahasiswa dan wali telah diisi!'); $menggambar = Hobi::create(array('hobi' => 'Menggambar')); $ngoding = Hobi::create(array('hobi' => 'Ngoding')); $puji->hobi()->attach($menggambar->id); $aul->hobi()->attach($ngoding->id); $ganin->hobi()->attach($menggambar->id); $ganin->hobi()->attach($ngoding->id); $this->command->info('Mahasiswa beserta Hobi telah diisi!'); }
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; }
public function show($id) { $jenjang = [0 => 'SD', 1 => 'SMP', 2 => 'SMA', 3 => 'D2', 4 => 'D3', 5 => 'D4', 6 => 'S1', 7 => 'S2']; $pendidikan = Pendidikan::findOrFail($id); $mahasiswa = Mahasiswa::findOrFail($pendidikan->mahasiswa_id); $pendidikan->mahasiswa_id = $mahasiswa['nama']; $pendidikan->jenjang = $jenjang[$pendidikan->jenjang]; return view('pendidikan.show', compact('pendidikan')); }
public function search(Request $request, Mahasiswa $mahasiswa) { $input = $request->json()->all(); // if (isset($input['start_ipk'])) { // if (empty($input['end_ipk'])) { // $input['end_ipk'] = $input['start_ipk']; // } // // if($input['start_ipk'] > $input['end_ipk']) { // $tmp = $input['start_ipk']; // $input['start_ipk'] = $input['end_ipk']; // $input['end_ipk'] = $tmp; // } // } $paginator = $mahasiswa->ipkBetween($input['start_ipk'], $input['end_ipk'])->yearBetween($input['start_year'], $input['end_year'])->searchName($input['nmmhs'])->searchNim($input['nimhs'])->searchJurusan($input['kdjur'])->filterStatus($input['status'])->sorting($input['sort'])->paginate(25); if ($paginator) { return $this->respondWithPaginate($paginator, new TracerTransformer()); } }
/** * Run the database seeds. */ public function run() { Model::unguard(); $if = ProgramStudi::create(['nama' => 'S1 Teknik Informatika', 'deskripsi' => 'Informatika adalah.....']); $ik = ProgramStudi::create(['nama' => 'S1 Ilmu Komputasi', 'deskripsi' => 'IK adalah.....']); $admin = Admin::create(); $user = User::create(['nama' => 'feber', 'username' => 'feber', 'password' => bcrypt('feber'), 'userable_id' => $admin->id, 'userable_type' => User::TYPE_ADMIN]); $dosen = Dosen::create(['nip' => '053', 'prodi_id' => $if->id]); $user = User::create(['nama' => 'mahar', 'username' => 'mahar', 'password' => bcrypt('mahar'), 'userable_id' => $dosen->id, 'userable_type' => User::TYPE_DOSEN]); $dosen = Dosen::create(['nip' => '054', 'prodi_id' => $ik->id]); $user = User::create(['nama' => 'sendy', 'username' => 'sendy', 'password' => bcrypt('sendy'), 'userable_id' => $dosen->id, 'userable_type' => User::TYPE_DOSEN]); $mahasiswa = Mahasiswa::create(['nim' => '1103', 'prodi_id' => $if->id]); $user = User::create(['nama' => 'dimas', 'username' => 'dimas', 'password' => bcrypt('dimas'), 'userable_id' => $mahasiswa->id, 'userable_type' => User::TYPE_MAHASISWA]); $mahasiswa = Mahasiswa::create(['nim' => '1107', 'prodi_id' => $ik->id]); $user = User::create(['nama' => 'ali', 'username' => 'ali', 'password' => bcrypt('ali'), 'userable_id' => $mahasiswa->id, 'userable_type' => User::TYPE_MAHASISWA]); MataKuliah::create(['nama' => 'Desain Analisis Algoritma', 'kode' => 'CSG1xx', 'deskripsi' => 'Main algoritma...', 'prodi_id' => $if->id]); MataKuliah::create(['nama' => 'Algoritma Struktur Data', 'kode' => 'CSG2xx', 'deskripsi' => 'ASD...', 'prodi_id' => $if->id]); MataKuliah::create(['nama' => 'Data Mining', 'kode' => 'CSH1xx', 'deskripsi' => 'Main data...', 'prodi_id' => $ik->id]); Model::reguard(); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * * @return \Illuminate\Http\Response */ public function store(Request $request) { DB::transaction(function () use($request) { $account = null; if ($request->role === User::TYPE_MAHASISWA) { $account = Mahasiswa::create(['nim' => $request->nim]); $account->prodi_id = $request->prodi_id; } elseif ($request->role === User::TYPE_DOSEN) { $account = Dosen::create(['nip' => $request->nip]); $account->prodi_id = $request->prodi_id; } else { $account = Admin::create(); } $user = new User(); $user->nama = $request->nama; $user->username = $request->username; $user->password = bcrypt($request->password); $user->userable_id = $account->id; $user->userable_type = get_class($account); $user->save(); }); return redirect('user'); }
public function getPost($kode, $kodeGrup) { if ($kodeGrup == 0) { $segmentKelas = "true"; $segmentGrup = "false"; } elseif ($kodeGrup > 0) { $segmentKelas = "false"; $segmentGrup = "true"; } else { $segmentKelas = "false"; $segmentGrup = "false"; } $id = Session::get('user'); if (Auth::user()->role == "mahasiswa") { $foto = Mahasiswa::where('nim', '=', $id)->first(); //Mendapatkan Array Kelas $kelasTmp = Mhskelas::select('kodekelas')->where('nim', '=', $id)->get(); for ($i = 0; $i < count($kelasTmp); $i++) { $kelas[$i] = $kelasTmp[$i]['kodekelas']; } //Mendapatkan Array Grup $grupTmp = AnggotaGrup::select('id_grup')->where('nim', '=', $id)->get(); for ($i = 0; $i < count($grupTmp); $i++) { $grup[$i] = $grupTmp[$i]['id_grup']; } $scope = array_merge($kelas, $grup); } else { $foto = Dosen::where('nip', '=', $id)->first(); $kelasTmp = Perkuliahan::select('kodekelas')->where('nip', '=', $id)->get(); for ($i = 0; $i < count($kelasTmp); $i++) { $scope[$i] = $kelasTmp[$i]['kodekelas']; } } $data = array('post' => Post::with(array('komentar', 'mhs', 'dosen', 'perkuliahan'))->whereIn('id_scope', $scope)->orderBy('id', 'desc')->take(10)->get(), 'postKelas' => Post::with(array('komentar', 'mhs', 'dosen', 'perkuliahan', 'grup'))->where('id_scope', '=', $kode)->where('scope', '=', 'kelas')->orderBy('id', 'desc')->get(), 'postGrup' => Post::with(array('komentar', 'mhs', 'grup', 'perkuliahan'))->where('id_scope', '=', $kodeGrup)->where('scope', '=', 'grup')->orderBy('id', 'desc')->get(), 'foto' => $foto, 'segmentKelas' => $segmentKelas, 'segmentGrup' => $segmentGrup); return view('frontend.includes.posts')->with($data); }
} }); Route::get('relasi-4', function () { $ganin = Mahasiswa::where('nama', '=', 'Ganine Vinanda')->first(); foreach ($ganin->hobi as $temp) { echo '<li>' . $temp->hobi . '</li>'; } }); Route::get('relasi-5', function () { $ngoding = Hobi::where('hobi', '=', 'Ngoding')->first(); foreach ($ngoding->mahasiswa as $temp) { echo '<li> Nama : ' . $temp->nama . ' <strong>' . $temp->nim . '</strong></li>'; } }); Route::get('eloquent', function () { $mahasiswa = Mahasiswa::with('wali', 'dosen', 'hobi')->get(); return View::make('eloquent', compact('mahasiswa')); }); //DUMMY DATA-FAKER LIBRARY get('blog', 'BlogController@index'); get('blog/{slug}', 'BlogController@showPost'); //FORM DAN VIEW Route::get('article/create', 'ArticleController@add'); Route::get('article', 'ArticleController@index'); //Route::get('article/{id}','ArticleController@baca'); Route::post('article', 'ArticleController@simpan'); //MIDDLEWARE Route::get('admin/profile', ['middleware' => 'auth', function () { // }]); Route::get('/', ['middleware' => ['first', 'second'], function () {
public function createmhs($id) { $mhs = \App\Mahasiswa::findOrFail($id); $mhs->type = '2'; return view('user.create', compact('mhs')); }
public function destroy($id) { $mahasiswa = Mahasiswa::find($id); $mahasiswa->delete(); return redirect('mahasiswa'); }
public function getUser($folder, $kelas, $grup, $tugasId) { $client = $this->getClient(); $getToken = User::find(Session::get('user_id')); //Token Expired dan Session masih aktif if ($client->isAccessTokenExpired() && $getToken->access_token != "") { $tempToken = json_decode($getToken->access_token); $client->refreshToken($tempToken->refresh_token); Session::put('access_token', $client->getAccessToken()); $getToken->refresh_token = $client->getAccessToken(); $getToken->save(); $service = new \Google_Service_Drive($client); $googlePlus = new \Google_Service_Plus($client); $file = new \Google_Service_Drive_DriveFile(); $userProfile = $googlePlus->people->get('me'); $emails = $userProfile->getEmails(); $photo = $userProfile->getImage(); $userId = $userProfile->getId(); /*$value = array("*****@*****.**","*****@*****.**"); for ($i=0; $i < 2; $i++) { $this->sharing($service,$this->getParent($service)[0]->id,"user","reader",$value[$i]); } */ if (count($this->getParent($service)) == 0) { $this->makeFolder($file, $service, "Collaborative Learning", null); $this->makeFolder($file, $service, "Materi", $this->getParent($service)[0]->id); $this->makeFolder($file, $service, "Tugas", $this->getParent($service)[0]->id); } $result = $this->getFolderItem($service, $this->getFolder($service, $folder), $kelas, $grup, $tugasId); $data = array('email' => $emails[0]->value, 'photo' => $photo->url, 'userId' => $userId, 'result' => $result, 'title' => 'test'); //User belum melakukan autentikasi } else { if (!Session::has('access_token') && $getToken->access_token == "") { $id = Session::get('user'); if (Auth::user()->role == "mahasiswa") { $pengguna = Mahasiswa::where('nim', '=', $id)->first(); } else { $pengguna = Dosen::where('nip', '=', $id)->first(); } $data = array('title' => 'test', 'user' => $pengguna->email); //Session tidak aktif tapi user telah melakukan autentikasi } else { if (!Session::has('access_token') && $client->getAccessToken()) { Session::put('access_token', $client->getAccessToken()); $data = array('title' => 'test'); } else { $client->setAccessToken(Session::get('access_token')); $data = array('title' => 'test'); } } } return view('frontend.includes.storage-content')->with($data); }
public function index() { $data = array('title' => "dashboard", 'dosen' => count(Dosen::where('status', '=', 1)->get()), 'mahasiswa' => count(Mahasiswa::where('status', '=', 1)->get()), 'matakuliah' => count(Matakuliah::where('status', '=', 1)->get()), 'perkuliahan' => count(Perkuliahan::where('status', '=', 1)->get()), 'userMhs' => User::with('mhs')->where('role', '=', 'mahasiswa')->get(), 'userDosen' => User::with('dosen')->where('role', '=', 'dosen')->get()); return view('backend.pages.backend-home')->with($data); }
public function changeStatus($id) { $mhs = Mahasiswa::find($id); $mhs->status = 0; $mhs->save(); // redirect Session::flash('message', 'Data mahasiswa berhasil di hapus'); return Redirect::to('dashboard/mahasiswa'); }