public function edit($id, $page = 'index') { $data = ['category_lists' => $this->kelas->getCategoryLists(), 'course' => $this->kelas->getCourse($id), 'repository' => new CourseRepository($id), 'sidebar_active' => 'basic', 'chapters' => Model\Kelas\Chapter::where('course_id', $id)->get()]; $this->template->set($data); $this->template->set_layout('dashboard_course'); if ($page == 'index') { $this->editIndex($id); return; } else { $this->template->set('sidebar_active', $page); call_user_func_array([$this, 'edit' . ucfirst($page)], [$id]); return; } }