refactor: Relocate news link display from its own table column to the title's description, remove the getRelations method, and enhance tags input with helper text.

This commit is contained in:
Yoga Pangestu 2026-03-13 09:39:39 +07:00
parent 6ced1ef7b4
commit 88c450af7f
3 changed files with 9 additions and 22 deletions

View File

@ -43,13 +43,6 @@ public static function table(Table $table): Table
return NewsTable::configure($table);
}
public static function getRelations(): array
{
return [
//
];
}
public static function getPages(): array
{
return [

View File

@ -45,7 +45,9 @@ public static function configure(Schema $schema): Schema
->placeholder('...')
->required()
->columnSpanFull(),
])->columnSpan(2),
Section::make([
TextInput::make('link')
->label('Tautan')
->placeholder('https://www.pwknews.com')
@ -53,9 +55,7 @@ public static function configure(Schema $schema): Schema
->nullable()
->maxLength(255)
->url(),
])->columnSpan(2),
Section::make([
Select::make('categories')
->label('Kategori')
->relationship('categories', 'name', function (Builder $query): Builder {
@ -75,7 +75,8 @@ public static function configure(Schema $schema): Schema
$component->state(
$record->tags->pluck('name')->toArray()
);
}),
})
->helperText('Tekan enter untuk menambahkan tag.'),
Radio::make('status')
->label('Status')

View File

@ -10,6 +10,7 @@
use App\Filament\Actions\Cheerful\RestoreAction;
use App\Filament\Actions\DefaultBulkActions;
use App\Filament\Columns\TimestampColumns;
use App\Models\News;
use Filament\Actions\BulkActionGroup;
use Filament\Support\Icons\Heroicon;
use Filament\Tables\Columns\TextColumn;
@ -27,13 +28,15 @@ public static function configure(Table $table): Table
->searchable()
->sortable()
->wrap()
->limit(50),
->limit(50)
->description(fn (News $record): string => $record->link),
TextColumn::make('author.name')
->label('Penulis')
->searchable()
->sortable()
->placeholder('Tidak ada'),
TextColumn::make('categories.name')
->label('Kategori')
->listWithLineBreaks()
@ -50,15 +53,6 @@ public static function configure(Table $table): Table
->badge()
->placeholder('Tidak ada tag'),
TextColumn::make('link')
->label('Tautan')
->searchable()
->sortable()
->copyable()
->copyMessage('Tautan berhasil disalin')
->placeholder('Tidak ada')
->toggleable(isToggledHiddenByDefault: true),
TextColumn::make('status')
->label('Status')
->searchable()
@ -76,8 +70,7 @@ public static function configure(Table $table): Table
->label('Tgl Publish')
->searchable()
->sortable()
->date('l, d F Y H:i')
->toggleable(isToggledHiddenByDefault: true),
->date('l, d F Y H:i'),
...TimestampColumns::make(),
])