diff --git a/config/amethyst.attribute-schema.resolvers.php b/config/amethyst.attribute-schema.resolvers.php index d3a5c77..b31d465 100644 --- a/config/amethyst.attribute-schema.resolvers.php +++ b/config/amethyst.attribute-schema.resolvers.php @@ -12,4 +12,5 @@ 'DateTime' => Amethyst\AttributeSchemaResolvers\DateTimeResolver::class, 'DataName' => Amethyst\AttributeSchemaResolvers\DataNameResolver::class, 'MorphTo' => Amethyst\AttributeSchemaResolvers\MorphToResolver::class, + 'Yaml' => Amethyst\AttributeSchemaResolvers\YamlResolver::class, ]; diff --git a/src/AttributeSchemaResolvers/YamlResolver.php b/src/AttributeSchemaResolvers/YamlResolver.php new file mode 100644 index 0000000..60b9ba7 --- /dev/null +++ b/src/AttributeSchemaResolvers/YamlResolver.php @@ -0,0 +1,20 @@ +newEntity()->getTable(), function (Blueprint $table) use ($attributeSchema, $onChange, $options) { - $method = $this->getMethod($attributeSchema); + + $method = !empty($options->column) ? $options->column : $this->getMethod($attributeSchema); $arguments = $attributeSchema->getResolver()->getDatabaseArguments(); diff --git a/tests/Managers/AttributeSchemaYamlTest.php b/tests/Managers/AttributeSchemaYamlTest.php new file mode 100644 index 0000000..9b30d77 --- /dev/null +++ b/tests/Managers/AttributeSchemaYamlTest.php @@ -0,0 +1,15 @@ +resetFields(); + + $this->commonField('yaml', 'Yaml', ["valid:yaml"]); + + $this->resetFields(); + } +}