TextColumn::make('item_group')
->label('Item Group')
->badge()
->separator(',')
->limitList(3)
->expandableLimitedList()
->listWithLineBreaks()
->formatStateUsing(function ($state) {
if (! $state) {
return [];
}
if (is_string($state)) {
$decoded = json_decode($state, true);
$state = is_array($decoded)
? $decoded
: explode(',', $state);
}
return collect($state)
->map(fn ($item) => trim(str_replace(['"', '[', ']'], '', $item)))
->filter()
->values()
->first();
}),
TextColumn::make('item_group')
->label('Item Group')
->badge()
->separator(',')
->limitList(3)
->expandableLimitedList()
->listWithLineBreaks()
->formatStateUsing(function ($state) {
if (! $state) {
return [];
}
if (is_string($state)) {
$decoded = json_decode($state, true);
$state = is_array($decoded)
? $decoded
: explode(',', $state);
}
return collect($state)
->map(fn ($item) => trim(str_replace(['"', '[', ']'], '', $item)))
->filter()
->values()
->first();
}),