feat: implement Notion-like LMS (Course Player, Exam, Certificate) with R2 integration

This commit is contained in:
2026-01-24 11:11:19 +07:00
parent 594f3727f5
commit 27fc78e811
17 changed files with 1139 additions and 30 deletions

View File

@@ -27,12 +27,37 @@ class LessonForm
Textarea::make('content')
->columnSpanFull(),
TextInput::make('video_url')
->url(),
TextInput::make('content_pdf'),
->url()
->placeholder('https://youtube.com/watch?v=...')
->visible(fn (callable $get) => $get('type') === 'video'),
\Filament\Forms\Components\SpatieMediaLibraryFileUpload::make('content_pdf')
->collection('content_pdf')
->disk('r2')
->visibility('public')
->acceptedFileTypes(['application/pdf'])
->label('Upload PDF Material')
->visible(fn (callable $get) => $get('type') === 'pdf'),
// Legacy URL input if needed, or remove. Keeping it hidden if empty?
// Let's keep it as an alternative or just replace it.
// Assuming we want to fully switch to upload:
// TextInput::make('content_pdf')->label('PDF URL (Legacy)'),
TextInput::make('duration_seconds')
->required()
->numeric()
->default(0),
->default(0)
->suffix('Seconds'),
\Filament\Forms\Components\SpatieMediaLibraryFileUpload::make('attachments')
->collection('attachments')
->disk('r2')
->visibility('public')
->multiple()
->downloadable()
->label('Attachments (Downloadable Resources)'),
Toggle::make('is_free_preview')
->required(),
TextInput::make('order_index')
@@ -40,7 +65,8 @@ class LessonForm
->numeric()
->default(0),
Textarea::make('metadata')
->columnSpanFull(),
->columnSpanFull()
->rows(5),
Select::make('vocabularies')
->relationship('vocabularies', 'word')
->multiple()