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?
Solution:Jump to solution
Check the upgrade guide:
https://filamentphp.com/docs/3.x/tables/upgrade-guide#badgecolumnenum-removed...
5 Replies
How did you set names in v2?
Can't you just map them via
getStateUsing()
?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.
And this isn't working anymore?
Ah it was removed
Solution
->formatStateUsing(function ($record) {
return $record->translate_status == '1' ? 'Tamamlandı' : 'Tamamlanmadı';
}) Thanks I solved this.