public function editTopic($topic_id) { $user = Auth::user(); //get the mapping for lecturer $kode_dosen = $user->lecturer->Kode_Dosen; //get Kode_Matkul & Nama_Matkul from course $courses = Course::courseMapByLecturerId($kode_dosen); //filter by code dosen $courses_arr = Helpers::toAssociativeArrays($courses); $counter_pertemuan = array(); for ($i = 1; $i <= 16; $i++) { $counter_pertemuan[$i] = $i; } //query again to get the correct data based on the given course_id $topic = Topic::topicById($topic_id); return view('lecturers.edittopic')->with('courses', $courses_arr)->with('counter_p', $counter_pertemuan)->with('topic', $topic); }