Supported Versions: PHP 8 >= 8.1.0
Checks if the enum has been defined
<?php enum_exists(string $enum, bool $autoload = true): bool
<?php             return $target->setRelation($key, $value);

        }



        if (array_key_exists($key, $target->getCasts()) && enum_exists($target->getCasts()[$key]) && $value === '') {

            $value = null;

        }