Create a Custom Entity

  • Alexandro Martínez
    Author
    by Alexandro Martínez
    2 years ago
  • 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.

    Entities

    💿 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":

    Project Properties

    💿 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.

    Icon

    💿 Paste the URL in the Icon field:

    Task Entity

    💿 Click on the Save button, and add the following properties:

    Task Properties

    💿 Go to /app/acme-corp-1/projects/new and create a project Project 1.

    Project 1

    💿 Now go to /app/acme-corp-1/tasks/new, and create the following task:

    Task 1

    You will be redirected to the Task Details autogenerated view:

    Task Details

    💿 Finally go to /app/acme-corp-1/settings/audit-trails to view the Project and Task logs:

    Project and Task logs

    I hope this quick guide was useful! Let me know if you have any questions.

    We respect your privacy.

    TLDR: We use cookies for language selection, theme, and analytics. Learn more.