Set text on the badge according to the value

I have this badge that takes from id_topic the topic number on the forum where comments are open.
If id_topic is 0 then comments are closed, if it contains an id above 0 then comments are open.
I have tried this, but inside the badge it always returns me the id of id_topic and not the words "open" or "close"

TextColumn::make('id_topic')
    ->badge(fn ($state): string => $state > 0 ? 'Open' : 'Close')
    ->color(fn ($state): string => $state > 0 ? 'success' : 'gray')
    ->label('Comments'),
Was this page helpful?