How to display an enum's label rather than value in a TextColumn?

My Customer model has a priority column which stores any one of these values: 1, 2, 3.


class Customer extends Model
{
    public const PRIORITY_SELECT = [
        1 => 'Low',
        2 => 'Medium',
        3 => 'High',
    ];
}


How do I make TextColumn::make('priority') display the value instead of the key?

Here's what I have. However I don't want this displayed as a description but rather as the value itself.

Tables\Columns\TextColumn::make('priority')
    ->badge()
    ->description(fn (Customer $record): string => Customer::PRIORITY_SELECT[$record->priority])
    ->color(fn (string $state): string => match ($state) {
        '1' => 'gray',
        '2' => 'warning',
        '3' => 'success',
    }),
Solution
Found the solution. ->formatStateUsing()
Was this page helpful?