schema([ Schemas\Section::make('Core Info') ->schema([ Forms\Components\TextInput::make('word') ->label('Word (Kanji/Kana)') ->required() ->maxLength(255), Forms\Components\TextInput::make('reading') ->label('Reading (Kana)') ->required() ->maxLength(255), Forms\Components\TextInput::make('romaji') ->maxLength(255), Forms\Components\TextInput::make('meaning_id') ->label('Meaning (Bahasa Indonesia)') ->required() ->maxLength(255), Forms\Components\TextInput::make('meaning_en') ->label('Meaning (English)') ->required() ->maxLength(255), ])->columns(2), Schemas\Section::make('Metadata & Media') ->schema([ Forms\Components\Select::make('level_id') ->label('JLPT Level') ->relationship('level', 'code') ->searchable() ->preload() ->required(), Forms\Components\Select::make('type') ->options([ 'noun' => 'Noun', 'verb' => 'Verb', 'adjective' => 'Adjective', 'adverb' => 'Adverb', 'particle' => 'Particle', 'expression' => 'Expression', ]) ->required(), Forms\Components\FileUpload::make('audio_url') ->label('Pronunciation Audio') ->disk('r2') ->directory('audio/vocab') ->visibility('public') ->acceptedFileTypes(['audio/mpeg', 'audio/wav', 'audio/ogg']), ])->columns(2), ]); } public static function table(Table $table): Table { return $table ->columns([ Tables\Columns\TextColumn::make('word') ->label('Word') ->searchable() ->description(fn (Vocabulary $record): string => $record->reading), Tables\Columns\TextColumn::make('meaning_id') ->label('Meaning') ->searchable(), Tables\Columns\TextColumn::make('level.code') ->label('Level') ->badge() ->color(fn (?string $state): string => match ($state) { 'N1' => 'danger', 'N2' => 'warning', 'N3' => 'info', default => 'success', }), Tables\Columns\TextColumn::make('type') ->badge(), Tables\Columns\IconColumn::make('audio_url') ->label('Audio') ->icon('heroicon-o-speaker-wave') ->color(fn ($state) => $state ? 'success' : 'gray'), ]) ->filters([ Tables\Filters\SelectFilter::make('level_id') ->label('Level') ->relationship('level', 'code'), ]); } public static function getRelations(): array { return [ // ]; } public static function getPages(): array { return [ 'index' => ListVocabularies::route('/'), 'create' => CreateVocabulary::route('/create'), 'edit' => EditVocabulary::route('/{record}/edit'), ]; } }