Hi all,
is it possible for a TextColumn to display the key and the value when the DB field is an array?
TextColumn always returns a string without the keys.
I have that in my DB :
{"panel": "admin", "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:135.0) Gecko/20100101 Firefox/135.0"}
And I want to display that in my table :
• panel : admin
• user_agent : Mozilla/5.0 (Windows NT 10...
For that I try this :
TextColumn::make('properties')
->label('Détails')
->getStateUsing(fn($record) => $record->properties)
->listWithLineBreaks()
->bulleted()
->wrap()
->toggleable()
->html(),
But in the end all I get is this without the keys:
• admin
• Mozilla/5.0 (Windows NT 10...
If I DD $record->propreties, I get my array :
array:2 [▼ // xxx.php:175
"panel" => "admin"
"user_agent" => "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:135.0) Gecko/20100101 Firefox/135.0"
]
Thanks for your help 🙂
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('v...