FilamentF
Filament2y ago
Sayy

how to get data relationship from table text column in description

i just want to group like stock quantity then below its description from relationship can or not ?

Tables\Columns\TextColumn::make('productItems.stock')
                    ->numeric()
                    ->label('Stock Satuan')
                    ->formatStateUsing(function ($state) {
                        return str($state)->replace(',', ' |');
                    }),
Tables\Columns\TextColumn::make('productItems.satuan')
                    ->numeric()
                    ->label('Satuan')
                    ->formatStateUsing(function ($state) {
                        return str($state)->replace(',', ' | ');
                    }),
image.png
Solution
solve with code like this :
->description(fn (Product $record): string => $record->productItems()->pluck('satuan')->implode(', '))
Was this page helpful?