columns([ ...RowIndexColumn::make(), TextColumn::make('title') ->label('Judul Berita') ->searchable() ->sortable() ->wrap() ->limit(50) ->description(fn (News $record): ?string => $record->link), TextColumn::make('author.name') ->label('Penulis') ->searchable() ->sortable() ->placeholder('Tidak ada'), TextColumn::make('tags.name') ->label('Tag') ->listWithLineBreaks() ->limitList(3) ->expandableLimitedList() ->badge() ->placeholder('Tidak ada tag'), TextColumn::make('status') ->label('Status') ->searchable() ->sortable() ->badge() ->formatStateUsing(fn (NewsStatus $state): string => $state->getLabel()) ->color(fn (NewsStatus $state): string => $state->getColor()), TextColumn::make('views') ->label('Dilihat') ->sortable() ->alignCenter(), TextColumn::make('published_at') ->label('Tgl Publish') ->searchable() ->sortable() ->date('l, d F Y H:i'), ...TimestampColumns::make(), ]) ->filters([ SelectFilter::make('status') ->label('Status') ->options(NewsStatus::class) ->native(false), SelectFilter::make('tags') ->label('Tag') ->relationship('tags', 'name') ->multiple() ->preload() ->native(false), TrashedFilter::make() ->native(false) ->visible(fn () => auth()->user()?->hasRole(RoleEnum::DEVELOPER->value)), ]) ->recordActions([ EditAction::make(), DeleteAction::make(), ForceDeleteAction::make(), RestoreAction::make(), ]) ->toolbarActions([ BulkActionGroup::make([ ...DefaultBulkActions::make('Berita'), ]), ]) ->emptyStateIcon(Heroicon::OutlinedNewspaper) ->emptyStateHeading(fn () => CheerfulNotification::getByKey('news.content.empty_state_heading')) ->emptyStateDescription(fn () => CheerfulNotification::getByKey('news.content.empty_state')) ->defaultSort('created_at', 'desc') ->deferFilters(false) ->paginated([25, 50, 100, 'all']) ->deferLoading(); } }