FilamentF
Filamentβ€’3y ago
ouch

How to show array key in TextColumn

Hi i have Variant model whre i save json in format like this {"Name":"Value"} and i'm casting it
    protected $casts = [
        'variant_attributes_json' => 'array',
    ];

How could i display key into textcolumn or other column?
Because if i put it into textCol it in state is only value
  Tables\Columns\TextColumn::make('variant_attributes_json')


ps: I'm new to filament πŸ™‚
Solution
Try ->getStateUsing(fn ($record) => $record->variant_attributes_json) then
Was this page helpful?