public function editMatkul($id_course) { $course = Course::where('seksi', $id_course)->first(); //get all prodi information $prodis = Prodi::all(); //transform prodi to associative array $prodi_arr = array(); foreach ($prodis as $prodi) { $prodi_arr[$prodi->id] = $prodi->prodi; } $kode_dosen = $course->Kode_Dosen; //need to pass filled data to this view (extra parameter) $room = Room::room_name(); $room_arr = Helpers::toAssociativeArrays($room); $waktu_kuliah = WaktuKuliah::waktuMap(); $waktu_opts = Helpers::toAssociativeArrays($waktu_kuliah); return view('lecturers.editcourse')->with('prodi_options', $prodi_arr)->with('Kode_Dosen', $kode_dosen)->with('room_options', $room_arr)->with('course', $course)->with('waktu_options', $waktu_opts); }
public function profil() { $user = Auth::user(); //$user_data = $request->user(); $id = $user->id; $student = Student::where('id_user', $id)->first(); //$student $name = $student->Nama_Mhs; $noreg = $student->Noreg; $prodi_model = $student->prodi; $prodi_id = $prodi_model->id; $prodi_name = $prodi_model->prodi; $semester = $student->Semester; $alamat = $student->Alamat; $telepon = $student->Telepon; $mac = $student->Mac; $prodis = Prodi::all(); $prodi_arr = Helpers::modelAsAssociativeArray($prodis, 'id', 'prodi'); return view('students.profil', ['name' => $name, 'noreg' => $noreg, 'prodi' => $prodi_name, 'semester' => $semester, 'alamat' => $alamat, 'telepon' => $telepon, 'mac' => $mac, 'prodi_opts' => $prodi_arr, 'prodi_id' => $prodi_id]); }
/** * The reason we choose to implement this function in AuthController instead as trait is * for the functionality to work it needs to store a global variable in this class therefore, not suitable as trait */ public function getStudentRegistrationForm(Request $request) { //return view with extra parameter //check path if path not from auth/register forward to the page if (!$request->has('path')) { return view('auth.register'); } //return to registration form //else meaning it must has stored register data, global object within this class $reg_data = json_decode($request->input('reg_data'), true); //store reg_data as session $request->session()->put('reg_data', $reg_data); //pass along all prodi name $prodis = Prodi::all(); //transform prodi model to associative array; $prodi_arr = array(); foreach ($prodis as $prodi) { $prodi_arr[$prodi->id] = $prodi->prodi; } $reg_name = '\'' . $reg_data['name'] . '\''; return view('auth.student_registration', ['reg_name' => $reg_name, 'prodis' => $prodi_arr]); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($kode_prodi) { $prodi = Prodi::find($kode_prodi); $prodi->delete(); return Redirect::to('administrator/prodi')->with('msgs', 'Prodi berhasil dihapus!'); }