How to Reuse the Same DB Column in a TextColumn of Table

I would like to use one db column in two tabel colum. I have stock column that show how many part are available and I want to have a second column to check if some conditions are met, show badge. If I reuse the same column, ex. TextColumn::make('stock')->label('Stock Status')->formatStateUsing(), the original stock column (which showing the number) will be gone.
No description
2 Replies
Vp
Vp4mo ago
You can use ->getStateUsing like
Tables\Columns\TextColumn::make('stock_abc')
->getStateUsing(function ($record) {
dd($record)
})
Tables\Columns\TextColumn::make('stock_abc')
->getStateUsing(function ($record) {
dd($record)
})