@@ 36-49 (lines=14) @@ | ||
33 | * |
|
34 | * @return \Illuminate\Http\Response |
|
35 | */ |
|
36 | protected function adminDashboard() |
|
37 | { |
|
38 | $courses = DB::transaction(function () { |
|
39 | return Course::withCount('enrollments') |
|
40 | ->orderedList() |
|
41 | ->get(); |
|
42 | }); |
|
43 | ||
44 | $courses = $courses->groupBy(function ($course) { |
|
45 | return $course->present()->getOrdinalYear(); |
|
46 | }); |
|
47 | ||
48 | return view('admin.dashboard', compact('courses')); |
|
49 | } |
|
50 | ||
51 | /** |
|
52 | * Get the student's dashboard. |
@@ 25-36 (lines=12) @@ | ||
22 | * |
|
23 | * @return \Illuminate\Http\Response |
|
24 | */ |
|
25 | public function index() |
|
26 | { |
|
27 | $courses = DB::transaction(function () { |
|
28 | return Course::orderedList()->get(); |
|
29 | }); |
|
30 | ||
31 | $courses = $courses->groupBy(function ($course) { |
|
32 | return $course->present()->getOrdinalYear(); |
|
33 | }); |
|
34 | ||
35 | return view('courses.index', compact('courses')); |
|
36 | } |
|
37 | } |
|
38 |