a cell with a zero value is not displayed, even when formatting

the following code does not work:
TextColumn::make('is_notifications_allowed')
->label('Notifications')
->formatStateUsing(fn (?bool $state): string => match ($state) {
true => 'Allowed',
false => 'Prohibited',
null => 'Waiting',
})
->badge()
TextColumn::make('is_notifications_allowed')
->label('Notifications')
->formatStateUsing(fn (?bool $state): string => match ($state) {
true => 'Allowed',
false => 'Prohibited',
null => 'Waiting',
})
->badge()
is it possible to work around this behavior?
Solution:
in make(), specify a non-zero column in formatStateUsing(), take the value of the desired column from the $record variable ```php TextColumn::make('id')...
Jump to solution
1 Reply
Solution
Smykoil
Smykoil7mo ago
in make(), specify a non-zero column in formatStateUsing(), take the value of the desired column from the $record variable
TextColumn::make('id')
->label('Notifications')
->formatStateUsing(
fn (Chat $record): string => match ($record->is_notifications_allowed) {
true => 'Allowed',
false => 'Prohibited',
null => 'Waiting',
}
)
->badge()
TextColumn::make('id')
->label('Notifications')
->formatStateUsing(
fn (Chat $record): string => match ($record->is_notifications_allowed) {
true => 'Allowed',
false => 'Prohibited',
null => 'Waiting',
}
)
->badge()
Want results from more Discord servers?
Add your server