Refactor News management features: replace author text input with a searchable select component in NewsResource, update NewsPageController to fetch news with authors and recent articles, and enhance the news show view to display author details and comments more effectively.
This commit is contained in:
1 parent
1b4989b440
commit
6b0c92d838
12 files changed
+360
-52
No files matched your search
@@ -9,6 +9,7 @@
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Components\RichEditor;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
@@ -48,9 +49,11 @@ public static function form(Form $form): Form
|
||||
->directory('news')
|
||||
->nullable()
|
||||
->columnSpanFull(),
|
||||
TextInput::make('author')
|
||||
->required()
|
||||
->maxLength(255),
|
||||
Select::make('author_id')
|
||||
->relationship('author', 'name')
|
||||
->searchable()
|
||||
->preload()
|
||||
->required(),
|
||||
RichEditor::make('content')
|
||||
->required()
|
||||
->columnSpanFull(),
|
||||
@@ -75,7 +78,8 @@ public static function table(Table $table): Table
|
||||
Tables\Columns\TextColumn::make('slug')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('author')
|
||||
Tables\Columns\TextColumn::make('author.name')
|
||||
->label('Author Name')
|
||||
->searchable()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('published_at')
|
||||
|
||||
Reference in new issue
Block a user