Generating default-value function (like uuid) plugin for Payload CMS.
Please refer to the documentations for the installation and usages.
Under payload.config.ts
:
export default buildConfig({
// ..other payload configs
plugins: [
// ..other plugins
genDefaultValueForIdPlugin({
// list of collection(s) to apply
collections: ['slug_name_1', 'slug_name_2'],
// function to generate each time to
defaultFunc: () => uuidv4()
})
// storage-adapter-placeholder
],
})