F
Filament10mo ago
Roberto

help me fix this match statement

hello there, i'm new to php, laravel and filament help me fix this match statement how do i do the comparison of > on a table record item?
No description
2 Replies
Roberto
Roberto10mo ago
pool_variation is decimal value
cheesegrits
cheesegrits10mo ago
I think the only way to do that is with a "non identity" check, like ...
match(true) {
$record->pool_variation > 0 => 'blah blah',
$record->pool_variation < 0 => 'blah blah',
default => 'opacity-30',
}
match(true) {
$record->pool_variation > 0 => 'blah blah',
$record->pool_variation < 0 => 'blah blah',
default => 'opacity-30',
}
See "Using match expressions to handle non identity checks" https://www.php.net/manual/en/control-structures.match.php