Table TextColumn of a toggle how to display Enabled / Disabled instead of 1 / 0?
Hi, as the title says really, I have a column that is stored as a simple 1 / 0 in the DB, but I need it to display to the viewer as Enabled / Disabled. My code looks like this:
Tables\Columns\TextColumn::make('enable_live')
->badge()
->color(fn (string $state): string => match ($state) {
'0' => 'gray',
'1' => 'success',
})
->sortable(),
I've read through the documentation and I've Googled extensively but I can't figure it out. Can anyone point me in the right direction?
1 Reply
Solution
Ah, I found the answer, ->formatStateUsing sorry to bother you all π