<?php

namespace App\Filament\Student\Pages;

use Filament\Pages\Page;

class MyEnrolledCourses extends Page
{
    protected string $view = 'filament.student.pages.my-enrolled-courses';

    protected static ?string $navigationLabel = 'My Courses';

    protected static ?string $title = 'My Courses';

    protected static ?int $navigationSort = 3;

    protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-bookmark-square';

    public function getViewData(): array
    {
        return [
            'courses' => \App\Models\Course::whereHas('students', function ($query) {
                $query->where('user_id', auth()->id());
            })->where('is_active', true)->get(),
        ];
    }
}
