I am using Filament admin panel in Laravel.
Filament v3.3.14, Laravel 12x
I have found this great little function to alternate my icons depending on the value (0 or 1).
TablesColumnsIconColumn::make('paid')
->icon(fn (string $state): string => match ($state) {
'1' => 'heroicon-o-check-circle',
'0' => 'heroicon-o-x-circle',
})
I would like to use it on a different function with text values as below:
TablesColumnsIconColumn::make('test_value')
->icon(fn (string $state): string => match ($state) {
'high' => 'heroicon-o-check-circle',
'medium' => 'heroicon-o-x-circle',
'low' => 'heroicon-o-x-circle',
'extreme' => 'heroicon-o-x-circle',
})
But the test_value will often end up with values like “Medium (12)” or “Extreme (25)”.
Is there a way to loosen up the string match? Similar to a LIKE or CONTAINS?
I cannot locate any direction out in the wide yonder internet.
Would greatly appreciate if you have any suggestions.