页面 · Laravilt
Your First Resource
The files laravilt:resource generates, and how to customize the resource, form and table.
This page walks through the Product resource from the Quick Start and customizes each part.
The resource class
app/Laravilt/Admin/Resources/Product/ProductResource.php connects the model to its form, table, infolist and pages:
With --simple (or by answering "yes" to the simple question), you get one ManageProduct page that handles create and edit in modals.
The form
Form/ProductForm.php returns a schema of fields. Fields come from laravilt/forms, and layout components such as Section come from laravilt/schemas:
Fields can react to each other with ->live() and ->afterStateUpdated(...). See Reactive Fields and Validation.
The table
Table/ProductTable.php defines columns, filters and actions. Actions come from laravilt/actions:
See Columns, Filters and Actions.
More generators
| Command | Creates |
|---|---|
php artisan laravilt:relation admin Product reviews | A relation manager for a relationship. |
php artisan laravilt:nested Variant --parent=Product | A resource nested under another. |
php artisan laravilt:page admin Reports --type=table | A custom page (.vue or .tsx, depending on your stack). |
php artisan laravilt:widget --panel=admin --type=stats | A dashboard widget. |
Continue with Panel & Resources.