schema([ Section::make('基础信息') ->schema([ TextInput::make('title') ->label('标题') ->required() ->maxLength(255), TextInput::make('slug') ->label('Slug') ->required() ->maxLength(255), Textarea::make('summary') ->label('摘要') ->rows(2) ->nullable(), MarkdownEditor::make('content_md') ->label('正文') ->columnSpanFull() ->required(), ])->columns(2), Section::make('媒体与标签') ->schema([ FileUpload::make('cover') ->label('封面') ->disk('public') ->directory('articles/cover') ->image() ->imagePreviewHeight('120') ->nullable(), TextInput::make('author') ->label('作者') ->maxLength(255) ->nullable(), Select::make('tags') ->label('标签') ->multiple() ->relationship('tags', 'name') ->preload(), ])->columns(2), Section::make('状态与SEO') ->schema([ TextInput::make('view_count') ->label('浏览量') ->numeric() ->disabled() ->dehydrated(false), Select::make('status') ->label('状态') ->options([ 'draft' => '草稿', 'published' => '发布', ]) ->required(), DateTimePicker::make('published_at') ->label('发布时间') ->nullable(), TextInput::make('seo_title') ->label('SEO 标题') ->maxLength(255) ->nullable(), TextInput::make('seo_description') ->label('SEO 描述') ->maxLength(255) ->nullable(), ])->columns(2), ]); } public static function table(Table $table): Table { return $table ->columns([ TextColumn::make('title')->label('标题')->searchable()->sortable(), TextColumn::make('status')->label('状态')->sortable(), TextColumn::make('view_count')->label('浏览')->sortable(), TextColumn::make('published_at')->label('发布时间')->dateTime(), TextColumn::make('created_at')->label('创建时间')->dateTime(), ]) ->filters([ // ]) ->actions([ Tables\Actions\EditAction::make(), ]) ->bulkActions([ Tables\Actions\BulkActionGroup::make([ Tables\Actions\DeleteBulkAction::make(), ]), ]) ->emptyStateActions([ Tables\Actions\CreateAction::make(), ]); } public static function getRelations(): array { return [ // ]; } public static function getPages(): array { return [ 'index' => Pages\ListArticles::route('/'), 'create' => Pages\CreateArticle::route('/create'), 'edit' => Pages\EditArticle::route('/{record}/edit'), ]; } }