一键导入
inertia-page-ctrl
Create a Go page controller that serves an Inertia.js page. Configures the EntityPageController with service, permissions, and optional stats.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create a Go page controller that serves an Inertia.js page. Configures the EntityPageController with service, permissions, and optional stats.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Create a broadcast notification system that sends notifications and messages to eligible users based on entity-specific criteria. Use when adding a new entity type that needs to notify users when records are created, updated, or published.
Guide for building non-CRUD pages with consistent design. Use when creating portal pages, custom views, detail modals, sidebar widgets, notification drawers, or any page that is not a standard CRUD table. Covers fullscreen modals, minimal text patterns, calendar widgets, doorbell notifications, optimistic updates, and CrudPage read-only integration.
Guide for building dashboards, charts, KPI cards, and data visualizations. Use when creating dashboard pages, adding charts to features, building stat displays, aggregating data for visual presentation, or implementing export (CSV/PNG/fullscreen) for charts. Based on the Books dashboard implementation using Recharts and shadcn/ui chart components.
Deploy the application to staging or production. Validates, builds, pushes Docker image, deploys via Helm, and runs smoke tests.
Run a comprehensive E2E browser test suite for a newly scaffolded Goravel entity. Tests navigation, CRUD operations, search, filters, row actions, form validation, FK dropdowns, and cross-entity integration using Playwright MCP.
Create a Go database seeder for a Goravel entity with 25+ realistic records. Covers all status/enum values, diverse data for sorting/pagination testing, and proper nullable field handling.
| name | inertia-page-ctrl |
| description | Create a Go page controller that serves an Inertia.js page. Configures the EntityPageController with service, permissions, and optional stats. |
| argument-hint | [EntityName] |
| allowed-tools | Bash, Read, Write, Edit, Grep, Glob |
Create page controller for $ARGUMENTS.
go run . artisan make:page-ctrl --controller=$ARGUMENTS
This creates app/http/controllers/<entity>s/<entity>s_page_controller.go.
package entitynames
import (
"books-database/app/auth"
"books-database/app/contracts"
"books-database/app/services"
)
type EntityPageController struct {
*contracts.GenericPageController
entityService *services.EntityService
}
func NewEntityPageController() *EntityPageController {
entityService := services.NewEntityService()
return &EntityPageController{
GenericPageController: contracts.NewGenericPageController(contracts.GenericPageConfig{
ResourceType: "entities", // Plural snake_case
PageComponent: "Entity/Index", // React component path under resources/js/pages/
Service: entityService,
ServiceIdentifier: auth.ServiceEntity, // From permission_constants.go
StatsEnabled: false, // Set true for badge counts
// StatsBuilder: func(controller *contracts.GenericPageController) map[string]interface{} {
// stats, _ := entityService.GetEntityStatistics()
// return stats
// },
}),
entityService: entityService,
}
}
| Field | Purpose | Example |
|---|---|---|
ResourceType | Plural snake_case resource name | "configs", "books" |
PageComponent | React component path | "Config/Index", "Book/Index" |
Service | CRUD service instance | configService |
ServiceIdentifier | Permission service constant | auth.ServiceConfig |
StatsEnabled | Enable statistics | true / false |
StatsBuilder | Function returning stats map | See template above |
The GenericPageController.Index() method automatically passes:
{
data: PaginatedResult<Entity>, // Paginated entity list
filters: ListRequest, // Current page/sort/search/filter state
permissions: {
canCreate: boolean,
canEdit: boolean,
canDelete: boolean,
},
stats?: Record<string, any>, // If StatsEnabled=true
meta: {
pagination: {
defaultPageSize: number,
maxPageSize: number,
allowedSizes: number[],
},
},
}
In routes/web.go:
// Import
entityPageController := entitynames.NewEntityPageController()
// Route (inside authenticated middleware group)
router.Get("/admin/entity-names", entityPageController.Index)
If you want badge counts on simple filters, create a statistics method on the service:
func (s *EntityService) GetEntityStatistics() (map[string]interface{}, error) {
var totalCount, activeCount, inactiveCount int64
totalCount, _ = facades.Orm().Query().Model(&models.Entity{}).Count()
activeCount, _ = facades.Orm().Query().Model(&models.Entity{}).Where("status = ?", "ACTIVE").Count()
inactiveCount, _ = facades.Orm().Query().Model(&models.Entity{}).Where("status = ?", "INACTIVE").Count()
return map[string]interface{}{
"totalCount": totalCount,
"activeCount": activeCount,
"inactiveCount": inactiveCount,
}, nil
}
Then enable in page controller:
StatsEnabled: true,
StatsBuilder: func(controller *contracts.GenericPageController) map[string]interface{} {
stats, _ := entityService.GetEntityStatistics()
return stats
},
After configuring the page controller and registering the web route:
# Vet the controllers package
go vet ./app/http/controllers/...
# Confirm full project compiles
go build ./...
See app/http/controllers/configs/configs_page_controller.go for a complete example.