change color of money based on another column value
hello good morning i am sorry it is simple task but i am not able to do that so
i have a column named type where i have enum "payout", "commission" and next i have a column amount where i want that if data type is payout then it will show in success color $3224 (example amount) and if f data type is commission then it will show in danger color -$3224 (example amount in minus ).
here is my both code what can i do changes ??
Tables\Columns\TextColumn::make('type')
->badge()
->color(fn (string $state): string => match ($state) {
'payout' => 'info',
'commission' => 'success',
}),
Tables\Columns\TextColumn::make('amount')
->sortable()->searchable()->money('usd'),
here is sample image.
thank you in advance. π2 Replies