Resources overview
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.
Static configuration
Section titled “Static configuration”| 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 |
Quick actions (modal CRUD)
Section titled “Quick actions (modal CRUD)”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 pagePlayground: Categories uses quickActions — New, View, Edit, and row click open a modal over the list.
Builders
Section titled “Builders”| Method | Returns |
|---|---|
form() |
Create/edit schema |
table() |
List columns and defaults |
infolist() / detail() |
Show view (auto-derived if omitted) |
resourceActions() |
Header, row, bulk actions |
Lifecycle hooks
Section titled “Lifecycle hooks”| 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 |
Authorization
Section titled “Authorization”Override canViewAny, canCreate, canEdit, canDelete, or attach a policy class. See Auth & RBAC.