aryehraber / statamic-uuid
独一无二;与其他任何事物都不一样
v2.3.0
2024-05-13 11:20 UTC
Requires
- statamic/cms: ^3.0|^4.0|^5.0
This package is auto-updated.
Last update: 2024-09-13 12:03:14 UTC
README
独一无二;与其他任何事物都不一样
此字段类型会自动为空字段生成UUID。例如,如果您需要在Replicator的每行生成唯一、持久的ID,这可能会很有用。
安装
通过composer安装插件
composer require aryehraber/statamic-uuid
发布字段类型资源
php please vendor:publish --tag=uuid
用法
在您的蓝图内部,只需使用type: uuid
,如果该字段为空白,则将为其生成UUID。已占用的字段(包括先前生成的UUID)将不会被覆盖。
设置
示例
蓝图
fields: - handle: sections field: type: replicator sets: section: fields: - handle: uuid field: type: uuid - handle: fields field: type: replicator sets: value: fields: - handle: uuid field: type: uuid id_type: nanoid alphabet: ABCD1234 size: 5
输出
sections: - uuid: 026fd166-8638-4c21-9e38-730b4ab3d4ea type: section fields: - uuid: A4C11 type: value - uuid: 4a7ce0b0-0483-42d9-a7b0-ce0201dd9c84 type: section fields: - uuid: B1CB3 type: value - uuid: 41CD1 type: value
致谢
最初由Series Eight构建,现在由Aryeh Raber维护。