title; } public static function form(Schema $schema): Schema { return $schema->components([ Section::make() ->columns(2) ->schema([ // The name of a talk that was given once, in one language. // Translating it would invent a talk that never happened. TextInput::make('title') ->label(__('panel.talks.fields.title')) ->helperText(__('panel.talks.fields.title_hint')) ->required() ->maxLength(255) ->columnSpanFull(), TextInput::make('event') ->label(__('panel.talks.fields.event')) ->required() ->maxLength(255), TextInput::make('city') ->label(__('panel.talks.fields.city')) ->maxLength(120), DatePicker::make('held_at') ->label(__('panel.talks.fields.held_at')), Select::make('language') ->label(__('panel.talks.fields.language')) ->options(fn () => collect(config('locales.supported')) ->map(fn (array $meta, string $code) => $meta['native'] ?? $code) ->all()) ->default(config('locales.default')) ->required(), TextInput::make('video_url') ->label(__('panel.talks.fields.video_url')) ->url() ->maxLength(2048), TextInput::make('slides_url') ->label(__('panel.talks.fields.slides_url')) ->url() ->maxLength(2048), ]), Section::make() ->columns(2) ->schema([ Select::make('member_id') ->label(__('panel.talks.fields.member')) ->helperText(__('panel.talks.fields.member_hint')) ->relationship('member', 'name') ->searchable() ->preload(), Select::make('project_id') ->label(__('panel.talks.fields.project')) ->relationship('project', 'title->'.config('locales.default')) ->searchable() ->preload(), TranslatableTabs::make(fn (string $locale) => [ Textarea::make("summary.{$locale}") ->label(__('panel.talks.fields.summary')) ->rows(3) ->maxLength(500) ->columnSpanFull(), ])->columnSpanFull(), Toggle::make('is_public') ->label(__('panel.talks.fields.is_public')) ->default(true), ]), ]); } public static function table(Table $table): Table { return $table ->defaultSort('held_at', 'desc') ->columns([ TextColumn::make('title') ->label(__('panel.talks.fields.title')) ->weight('medium') ->description(fn (Talk $record) => trim($record->event.' · '.($record->city ?? ''), ' ·')) ->wrap() ->searchable(['title', 'event']), TextColumn::make('member.name') ->label(__('panel.talks.fields.member')) ->placeholder('—') ->toggleable(), TextColumn::make('held_at') ->label(__('panel.talks.fields.held_at')) ->date() ->placeholder('—') ->sortable(), IconColumn::make('video_url') ->label(__('panel.talks.fields.video_url')) ->boolean() ->toggleable(), IconColumn::make('is_public') ->label(__('panel.talks.fields.is_public')) ->boolean(), ]) ->filters([ TernaryFilter::make('is_public')->label(__('panel.talks.fields.is_public')), SelectFilter::make('member') ->label(__('panel.talks.fields.member')) ->relationship('member', 'name') ->searchable() ->preload(), ]) ->recordActions([ EditAction::make(), DeleteAction::make(), ]) ->toolbarActions([ BulkActionGroup::make([DeleteBulkAction::make()]), ]); } /** * @return array */ public static function getGloballySearchableAttributes(): array { return ['title', 'event']; } public static function getRelations(): array { return [ RevisionsRelationManager::class, ]; } public static function getPages(): array { return [ 'index' => ListTalks::route('/'), 'create' => CreateTalk::route('/create'), 'edit' => EditTalk::route('/{record}/edit'), ]; } }