schema([ Forms\Components\Select::make('module_id') ->relationship('module', 'title') ->searchable() ->preload() ->required(), Forms\Components\TextInput::make('title') ->required() ->maxLength(255) ->live(onBlur: true) ->afterStateUpdated(fn ($state, $set) => $set('slug', \Illuminate\Support\Str::slug($state))), Forms\Components\TextInput::make('slug') ->required() ->maxLength(255) ->unique(ignoreRecord: true), Forms\Components\Select::make('type') ->options([ 'video' => 'Video', 'text' => 'Text', 'quiz' => 'Quiz', 'vocab_list' => 'Vocabulary List', ]) ->default('text') ->required(), Forms\Components\FileUpload::make('content_pdf') ->label('Lesson PDF (Paid Content)') ->disk('r2_private') ->directory('pdfs') ->visibility('private') ->acceptedFileTypes(['application/pdf']) ->downloadable() ->columnSpanFull(), Forms\Components\RichEditor::make('content') ->columnSpanFull(), Forms\Components\TextInput::make('video_url') ->label('Video URL (YouTube/Vimeo)') ->url(), Forms\Components\Toggle::make('is_free_preview') ->label('Free Preview?') ->default(false), Forms\Components\TextInput::make('order_index') ->numeric() ->default(0), ]); } public static function table(Table $table): Table { return $table ->columns([ Tables\Columns\TextColumn::make('title') ->searchable(), Tables\Columns\TextColumn::make('module.title') ->sortable(), Tables\Columns\TextColumn::make('type') ->badge(), Tables\Columns\IconColumn::make('is_free_preview') ->boolean(), Tables\Columns\TextColumn::make('created_at') ->dateTime() ->sortable() ->toggleable(isToggledHiddenByDefault: true), ]) ->defaultSort('order_index', 'asc'); } public static function getRelations(): array { return [ // ]; } public static function getPages(): array { return [ 'index' => ListLessons::route('/'), 'create' => CreateLesson::route('/create'), 'edit' => EditLesson::route('/{record}/edit'), ]; } public static function getRecordRouteBindingEloquentQuery(): Builder { return parent::getRecordRouteBindingEloquentQuery() ->withoutGlobalScopes([ SoftDeletingScope::class, ]); } }