Skip to content
Shamar

Resources overview

A resource is list + create + edit + show driven by builders.
export default class ProductResource extends Resource {
static model = Product
static slug = 'products'
static label = 'Products'
static navigationGroup = 'Content'
static form() { /* … */ }
static table() { /* … */ }
static infolist() { /* … */ }
}

A resource maps a model to admin CRUD routes. Shamar discovers *_resource.ts files under your panel path.

Property Purpose
model Lucid / Mongoose model class
slug URL segment (/demo/products)
label / singularLabel Navigation and headings
navigationGroup / navigationSubGroup Sidebar grouping
navigationSort / navigationHidden Order and visibility
recordTitleField Display title for breadcrumbs
icon Sidebar icon name
companyScoped Scope lists to current company
softDelete Soft-delete aware queries
contentMaxWidth Page width token
defaultPerPage Pagination default
quickActions When true, create/edit/view open in a modal over the list
createMode / editMode / viewMode 'page' (default) or 'modal' per operation

For simple resources (categories, tags, types), open create / edit / view in a dialog instead of a full page. The same routes and forms are used; only the presentation changes.

export default class CategoryResource extends Resource {
static model = Category
static slug = 'categories'
/** Shorthand: create, edit, and view all open in a modal. */
static quickActions = true
}

Or set modes individually:

static createMode = 'modal'
static editMode = 'modal'
static viewMode = 'page' // row click still navigates to the show page

Playground: Categories uses quickActions — New, View, Edit, and row click open a modal over the list.

Method Returns
form() Create/edit schema
table() List columns and defaults
infolist() / detail() Show view (auto-derived if omitted)
resourceActions() Header, row, bulk actions
Method When
prepareCreate(data) Before insert — mutate payload, flash messages
handleAction(name, ctx) Custom row/bulk/header action handlers
configure() Register callbacks on the resource class

Override canViewAny, canCreate, canEdit, canDelete, or attach a policy class. See Auth & RBAC.