schema([ Select::make('class_room_id') ->label('Class Room') ->required() ->options(ClassRoom::pluck('class_name', 'id')->toArray()) ->searchable() ->native(false), Select::make('subject_id') ->label('Mata Pelajaran') ->relationship('subject', 'name') ->required(), // Textarea for description Forms\Components\Textarea::make('description') ->rows(5) ->cols(10) ->required() ->maxLength(65535), // Max length for TEXT type in database ]); } public static function table(Table $table): Table { return $table ->columns([ // Display related Class Room name Tables\Columns\TextColumn::make('class.class_name') ->label('Kelas') ->searchable() ->sortable(), // Display related Subject name Tables\Columns\TextColumn::make('subject.name') ->label('Mapel') ->searchable() ->sortable(), // Display description, truncate for brevity in table Tables\Columns\TextColumn::make('description') ->label('Deskripsi') ->searchable() ->limit(50) // Limit text length in table ->tooltip(fn (LearningObjective $record): string => $record->description) // Show full text on hover ->sortable(), Tables\Columns\TextColumn::make('created_at') ->dateTime() ->sortable() ->toggleable(isToggledHiddenByDefault: true), Tables\Columns\TextColumn::make('updated_at') ->dateTime() ->sortable() ->toggleable(isToggledHiddenByDefault: true), Tables\Columns\TextColumn::make('deleted_at') // Add this column to show deleted timestamp ->dateTime() ->sortable() ->toggleable(isToggledHiddenByDefault: true), ]) ->filters([ Tables\Filters\TrashedFilter::make()->label('Tampilkan Data yang Dihapus'), ]) ->actions([ Tables\Actions\EditAction::make()->visible(fn () => auth()->user()->hasRole('admin')), Tables\Actions\DeleteAction::make()->visible(fn () => auth()->user()->hasRole('admin')), Tables\Actions\RestoreAction::make()->visible(fn (LearningObjective $record) => auth()->user()->hasRole('admin') && $record->trashed()), ]) ->bulkActions([ Tables\Actions\BulkActionGroup::make([ Tables\Actions\DeleteBulkAction::make()->visible(fn () => auth()->user()->hasRole('admin')), ]), ]); } public static function getRelations(): array { return [ // Define any relation managers here if needed ]; } public static function getPages(): array { return [ 'index' => Pages\ListLearningObjectives::route('/'), 'create' => Pages\CreateLearningObjective::route('/create'), 'edit' => Pages\EditLearningObjective::route('/{record}/edit'), ]; } public static function getEloquentQuery(): Builder { return parent::getEloquentQuery() ->withoutGlobalScopes([ SoftDeletingScope::class, ]); } public static function getNavigationLabel(): string { return 'Tujuan Pembelajaran'; } public static function getBreadcrumb(): string { return 'Tujuan Pembelajaran'; } public static function getPluralModelLabel(): string { return 'Tujuan Pembelajaran'; } }