Color change by Task
Need a help with TextEntry::make('task.name') in infolist , where task is Won,Lost and Taken , how can I change there color by task and make it visible in view-infolist
I tried this but did not worked \\
->getStateUsing(fn (Lead $record): string => $record->created_at?->isPast()? 'Won' : 'Lost') ->colors([ 'success' => 'Won', 'danger' => 'Lost' ]), \\
->getStateUsing(fn (Lead $record): string => $record->created_at?->isPast()? 'Won' : 'Lost') ->colors([ 'success' => 'Won', 'danger' => 'Lost' ]), \\
12 Replies
Can someone reply here ?
try this:
It shows each status in green only @awcodes
did you remove
->colors()
also might want to make sure you're getting the correct 'won' or 'lost' from the ternaryYes I did
maybe i'm misunderstanding what you are trying to do, but it's working for me in the demo
wouldn't created_at always be in the past though.
$record->status->name may be I'm calling the record wrong
its status.name
its status name won lost taken etc
i think it's because created at will always be in the past, and therefor will never evaluate to 'lost'
oh ok
if you swap 'won' and 'lost' you'll see that the color works. so it's just an issue with the logic. π
ok thankyou π