fix: String state cast enum support

This commit is contained in:
Dan Harrin
2025-09-15 17:24:49 +01:00
parent 9ed433e005
commit 452c33170f
2 changed files with 18 additions and 0 deletions
@@ -2,6 +2,7 @@
namespace Filament\Schemas\Components\StateCasts;
use BackedEnum;
use Filament\Schemas\Components\StateCasts\Contracts\StateCast;
class StringArrayStateCast implements StateCast
@@ -26,6 +27,10 @@ class StringArrayStateCast implements StateCast
return $carry;
}
if ($stateItem instanceof BackedEnum) {
$stateItem = $stateItem->value;
}
$carry[] = strval($stateItem);
return $carry;
@@ -54,6 +59,10 @@ class StringArrayStateCast implements StateCast
return $carry;
}
if ($stateItem instanceof BackedEnum) {
$stateItem = $stateItem->value;
}
$carry[] = strval($stateItem);
return $carry;
@@ -2,6 +2,7 @@
namespace Filament\Schemas\Components\StateCasts;
use BackedEnum;
use Filament\Schemas\Components\StateCasts\Contracts\StateCast;
class StringStateCast implements StateCast
@@ -16,6 +17,10 @@ class StringStateCast implements StateCast
return null;
}
if ($state instanceof BackedEnum) {
$state = $state->value;
}
return strval($state);
}
@@ -25,6 +30,10 @@ class StringStateCast implements StateCast
return null;
}
if ($state instanceof BackedEnum) {
$state = $state->value;
}
return strval($state);
}
}