blob: ff0b81015c5b0d5c18ae043bf6783ac59de1c3e5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
<?php
namespace App\Http\Controllers;
use App\Models\Group;
use App\Models\Lesson;
use App\Models\Student;
use App\Models\Teacher;
class DashboardController extends Controller
{
public function index()
{
return view('dashboard', [
'teacherCount' => Teacher::count(),
'groupCount' => Group::count(),
'studentCount' => Student::count(),
'lessonCount' => Lesson::count(),
'recentLessons' => Lesson::with('group')
->orderBy('scheduled_at', 'desc')
->limit(5)
->get(),
'topStudents' => Student::with('group')
->orderBy('points', 'desc')
->limit(5)
->get(),
'newsLessons' => Lesson::with(['group', 'teacher'])
->orderBy('created_at', 'desc')
->limit(6)
->get(),
]);
}
}
|