Create a Custom Entity
Goals:
- Create a Custom Entity
- Add Properties of types: TEXT, NUMBER, DATE, BOOLEAN, ENTITY, MEDIA, and SELECT
- Add a Entity Rows with the Autogenerated Views and Forms
Steps
💿 Go to the /admin/entities
page.
💿 Click on the New button.
💿 Create a Proyect entity with the following values:
- Name: project
- Slug: projects
- Title: Project
- Plural: Projects
- Prefix: PRO
💿 Click on the Save button.
You'll be redirected to the /admin/entities/projects/properties
route.
💿 Add a "Name" Property of type "Text":
💿 Now let's create the Task entity, with the following values:
- Name: task
- Slug: tasks
- Title: Task
- Plural: Tasks
- Prefix: TSK
💿 Let's grab an icon, go to icons8, pick an icon, click download, and copy the URL:
You can use this URL: https://img.icons8.com/color/48/000000/task--v1.png
.
💿 Paste the URL in the Icon field:
💿 Click on the Save button, and add the following properties:
Name | Title | Type | Description |
---|---|---|---|
project | Project | Entity | Select the Project entity |
order | Order | Int | |
name | Name | String | |
dueDate | Due Date | DateTime | |
priority | Priority | Select | Low, Medium, High |
completed | Completed | Boolean | |
attachments | Attachments | Media | For PDF's or images |
subtask | Subtask | String | Click 'Show advanced options' and check 'Is detail' |
You should have the following properties:
💿 Go to /app/acme-corp-1/projects/new
and create a project Project 1
.
💿 Now go to /app/acme-corp-1/tasks/new
, and create the following task:
You will be redirected to the Task Details autogenerated view:
NOTE
WARNING
💿 Finally go to /app/acme-corp-1/settings/audit-trails
to view the Project and Task logs:
I hope this quick guide was useful! Let me know if you have any question.