Skip to content

Commit

Permalink
- dashboard counters
Browse files Browse the repository at this point in the history
  • Loading branch information
krzysztofrewak committed Nov 7, 2023
1 parent 81ee29d commit 53be982
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/Http/Controllers/Dashboard/DashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ class DashboardController extends Controller
{
public function __invoke(): Response
{
$activeSemester = Semester::getActive();

return inertia("Dashboard/Home", [
"name" => explode(" ", Setting::query()->first()?->teacher_name ?? "")[0],
"counters" => [
[
["name" => "Liczba studentów w tym semestrze", "value" => Semester::getActive()?->students()->count() ?? 0],
["name" => "Liczba kursów w tym semestrze", "value" => Semester::getActive()?->courses()->count() ?? 0],
["name" => "Liczba grup w tym semestrze", "value" => Semester::getActive()?->groups()->count() ?? 0],
["name" => "Liczba studentów w tym semestrze", "value" => $activeSemester?->students()->count() ?? 0],
["name" => "Liczba kursów w tym semestrze", "value" => $activeSemester?->courses()->count() ?? 0],
["name" => "Liczba grup w tym semestrze", "value" => $activeSemester?->groups()->count() ?? 0],
],
[
["name" => "Liczba studentów", "value" => Student::query()->count()],
Expand Down

0 comments on commit 53be982

Please sign in to comment.