Badge Column Problem

TextColumn::make('translate_status') ->badge() ->color(fn (string $state): string => match ($state) { '0' => 'gray', '1' => 'warning', 'published' => 'success', 'rejected' => 'danger', }) In v2, I could previously name the badge column. I have boolean values true and false, but I cannot assign special names to them. Now it says 0 or 1. Isn't there a solution to this?
5 Replies
Dennis Koch
Dennis Koch12mo ago
How did you set names in v2? Can't you just map them via getStateUsing()?
Mehmet K.
Mehmet K.12mo ago
I have no idea exactly how to do this. BadgeColumn::make('status') ->enum([ 'draft' => 'Draft', 'reviewing' => 'Reviewing', 'published' => 'Published', ]) I could normally do it this way.
Dennis Koch
Dennis Koch12mo ago
And this isn't working anymore? Ah it was removed
Mehmet K.
Mehmet K.12mo ago
->formatStateUsing(function ($record) { return $record->translate_status == '1' ? 'Tamamlandı' : 'Tamamlanmadı'; }) Thanks I solved this.
Want results from more Discord servers?
Add your server