Resources
Resources are the core of Cockpit. It represents an administrable resource.
You can manage any kind of resources and by default Cockpit ship with a ModelResource
to manage Lucid Models. If you want to create custom resources, head over to the dedicated Custom Resources page.
Defining Resources
Cockpit bring a make:resource
command to easily create and register new resources.
By default, every Cockpit elements are generated inside app/cockpit
folder.
You can change this behavior with the cockpitPath
configuration option.
Learn more on the Configuration page.
Registering Resources
To make any Resource
available in your Cockpit dashboard, you need to register it in the start/cockpit.ts
file using the cockpit.resource
method.
Adonis Cockpit make:command
automatically registers
resources for you.
Resource configuration
Fields
The fields defines what data will be shown and how it will be displayed. You can configure the fields inside the fields
method of your resource.
Read more about the different available fields and their configuration on the dedicated Fields page.
Labels and Slug
By default, the ModelResource
automatically setup everything for you. But you might want to configure the labels and the slug that will be used across the administration pages of your resource.
Actions
Actions are operations that can be applied with one or multiple records. You can override the default actions and add custom ones by overriding the actions
method.
Read more about how to create custom Actions on the dedicated Actions documentation page