Files
lucent-laravel/docs/Schemas.md
T

84 lines
2.7 KiB
Markdown
Raw Normal View History

2023-10-31 01:48:29 +02:00
---
gitea: none
include_toc: true
---
2023-10-30 22:51:54 +02:00
2023-10-30 22:49:27 +02:00
# Schemas
Schemas define both the shape of your data and how the UI on the admin will behave.
There are 3 types of schemas
- Collections: Normal data
- Files: Images and files
- Block: Used in the block editor
## Collection Reference
- **name**: The ID of the collection. Camelcase and plural is the recommended format ex. blogPosts
- **label**: The friendly name of the schema
- **type**: The type of the collection. Should be "collection"
- **visible**: An array of field id to show on the content browser _optional_
- **groups**: A list if group ids to separate your field in different tabs _optional_
- **fields**: The list of your fields. Look the field reference for more
- **isEntry**: If this schema is important, it will show be visible on the main the sidebar. Default: false _optional_
- **sortBy**: The default sorting in the content browser _optional_
2024-08-23 21:06:53 +03:00
- **cardTitle**: Mustache code to customize the preview field _optional_
- **cardImage**: Field name of image you want to use as a preview image _optional_
2023-10-30 22:49:27 +02:00
- **revisions**: How many revisions are going to be kept for each record _optional_
- **read**: Array of user groups that have read permissions _optional_
- **write**: Array of user groups that have write permissions _optional_
## Files Reference
- **name**: The ID of the collection. Camelcase and plural is the recommended format ex. blogPosts
- **label**: The friendly name of the schema
- **type**: The type of the collection. Should be "files"
- **path**: The relative directory that these files will be stored.
- **groups**: A list if group ids to separate your field in different tabs _optional_
- **fields**: The list of your fields. Look the field reference for more
- **isEntry**: If this schema is important, it will show be visible on the main the sidebar _optional_
- **sortBy**: The default sorting in the content browser _optional_
2024-08-23 21:06:53 +03:00
- **cardTitle**: Mustache code to customize the preview field _optional_
2023-10-30 22:49:27 +02:00
- **revisions**: How many revisions are going to be kept for each record _optional_
- **read**: Array of user groups that have read permissions _optional_
- **write**: Array of user groups that have write permissions _optional_
A full Collection example without the fields:
```json
{
"label": "Departments",
"name": "departments",
"isEntry": true,
"type": "collection",
"visible": [
"slug",
"cover",
"_sys.updatedAt",
"status"
],
"groups": [
"Extra Info",
"Metadata",
"SEO"
],
"sortBy": "-_sys.createdAt",
2024-08-23 21:06:53 +03:00
"schemaTitle": "{{name}} {{slug}}",
"schemaImage": "cover",
2023-10-30 22:49:27 +02:00
"revisions": 15,
"read": [
"admin",
"editors",
"reviewers"
],
"write": [
"admin",
"editors"
],
"fields": []
}
```