Badge color doesn't update using Enum status

For text column inside table builder, when using a badge() with status casted from Enum, the color doesnt change when the status change. For example, when then status value is changed from activated to deactivated via form, the text inside badge will update to the getLabel() value, however, the color of the badge doesnt update. The text column code:
Tables\Columns\TextColumn::make('status'),
Tables\Columns\TextColumn::make('status'),
The enum status code:
<?php

namespace App\Enums;

use Filament\Support\Contracts\HasColor;
use Filament\Support\Contracts\HasLabel;

enum UserStatus: string implements HasLabel, HasColor
{
case Activated = 'activated';
case Deactivated = 'deactivated';

public function getLabel(): ?string
{
return match ($this) {
self::Activated => 'activated',
self::Deactivated => 'deactivated',
};
}

public function getColor(): array|string
{
return match ($this) {
self::Activated => 'success',
self::Deactivated => 'danger',
};
}
}
<?php

namespace App\Enums;

use Filament\Support\Contracts\HasColor;
use Filament\Support\Contracts\HasLabel;

enum UserStatus: string implements HasLabel, HasColor
{
case Activated = 'activated';
case Deactivated = 'deactivated';

public function getLabel(): ?string
{
return match ($this) {
self::Activated => 'activated',
self::Deactivated => 'deactivated',
};
}

public function getColor(): array|string
{
return match ($this) {
self::Activated => 'success',
self::Deactivated => 'danger',
};
}
}
I did make sure the status is casted to enum from my model, any help will be appreciated!
2 Replies
Want results from more Discord servers?
Add your server