public function show(SubjectRepositoryInterface $subjectRepo, CourseRepositoryInterface $repo, $subject_id, Request $request) { $subj = $subjectRepo->find($subject_id); $page = $request->input('page', 1); $paginator = $repo->getPaginator($subject_id); $paginator->setPath('/' . $request->path()); return $this->view->make('frontend.subjects.show', ['subj' => $subj, 'courses' => $paginator, 'single_page' => true, 'title' => sprintf('Which Course For Me | %s (%s) Courses', $subj['name'], $subj['id'])]); }
public function show(CourseRepositoryInterface $repo, SectionRepositoryInterface $sectionRepo, $subject_id, $course_id) { $course = $repo->find($course_id); $sections = $sectionRepo->all($course_id); $terms = []; foreach ($sections as $section) { if (!array_key_exists($section['term'], $terms)) { $terms[$section['term']] = ['id' => $section['term'], 'name' => term_name($section['term']), 'sections' => []]; } $terms[$section['term']]['sections'][] = $section; } array_set($course, 'sections', $sections); return $this->view->make('frontend.courses.show', ['course' => $course, 'single_page' => true, 'terms' => $terms, 'title' => sprintf('Which Course For Me | %s - %s', $course['id'], title_case($course['title']))]); }
public function show(CourseRepositoryInterface $courseRepo, $subject_id, $course_id) { return $this->createJsonResponse($courseRepo->find($course_id)); }