mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
Ensure array state cast values are arrays
This commit is contained in:
@@ -4,6 +4,7 @@ namespace Filament\Schemas\Components\StateCasts;
|
||||
|
||||
use BackedEnum;
|
||||
use Filament\Schemas\Components\StateCasts\Contracts\StateCast;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class EnumArrayStateCast implements StateCast
|
||||
{
|
||||
@@ -28,7 +29,7 @@ class EnumArrayStateCast implements StateCast
|
||||
}
|
||||
|
||||
return array_reduce(
|
||||
$state,
|
||||
Arr::wrap($state),
|
||||
function (array $carry, $stateItem): array {
|
||||
if (blank($stateItem)) {
|
||||
return $carry;
|
||||
@@ -62,7 +63,7 @@ class EnumArrayStateCast implements StateCast
|
||||
}
|
||||
|
||||
return array_reduce(
|
||||
$state,
|
||||
Arr::wrap($state),
|
||||
function (array $carry, $stateItem): array {
|
||||
if (blank($stateItem)) {
|
||||
return $carry;
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Filament\Schemas\Components\StateCasts;
|
||||
|
||||
use BackedEnum;
|
||||
use Filament\Schemas\Components\StateCasts\Contracts\StateCast;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
class OptionsArrayStateCast implements StateCast
|
||||
{
|
||||
@@ -21,7 +22,7 @@ class OptionsArrayStateCast implements StateCast
|
||||
}
|
||||
|
||||
return array_reduce(
|
||||
$state,
|
||||
Arr::wrap($state),
|
||||
function (array $carry, $stateItem): array {
|
||||
if (blank($stateItem)) {
|
||||
return $carry;
|
||||
@@ -57,7 +58,7 @@ class OptionsArrayStateCast implements StateCast
|
||||
}
|
||||
|
||||
return array_reduce(
|
||||
$state,
|
||||
Arr::wrap($state),
|
||||
function (array $carry, $stateItem): array {
|
||||
if (blank($stateItem)) {
|
||||
return $carry;
|
||||
|
||||
Reference in New Issue
Block a user