diff --git a/packages/support/src/Commands/Concerns/CanReadModelSchemas.php b/packages/support/src/Commands/Concerns/CanReadModelSchemas.php index 955d8eafba9..fd680b2f41d 100644 --- a/packages/support/src/Commands/Concerns/CanReadModelSchemas.php +++ b/packages/support/src/Commands/Concerns/CanReadModelSchemas.php @@ -9,7 +9,6 @@ use Illuminate\Support\Str; use ReflectionClass; use ReflectionException; -use function Illuminate\Support\enum_value; trait CanReadModelSchemas { @@ -234,6 +233,14 @@ public function getRecordTitleAttribute(): ?string protected function getEnumCasts($model) { $casts = app($model)->getCasts(); - return array_filter($casts, fn ($cast) => enum_exists($cast)); + return array_filter($casts, function ($cast) { + + if (class_exists($cast)) { + $reflection = new \ReflectionClass($cast); + return $reflection->isEnum(); + } + + return false; + }); } }