In this section · 4 articles

Scaffolder fields, options and generated files

Every field type, switch and per-field option on the Scaffolder, the files a resource and a module shell create or change, the matching commands, and the two permissions.

Applies to
Stub Generator 1.0 and later
Who can do this
Developer
Where
Scaffolder (Platform Administration)
On this page

The Scaffolder screen is a front end to Core's generator. Everything on it has a command-line equivalent, shown under the buttons as you fill in the form.

Blueprint (Resource mode)

FieldWhat it doesRules
ModuleThe module the resource goes into. It must exist in Modules/ before you generate.Required. Letters and digits, starting with a letter.
EntityThe record's singular name, such as Item. Class names, the table and the menu label come from it.Required. Letters and digits, starting with a letter.
AbbreviationThe permission abbreviation in feature.<abbr>.<resource>.<action>.Optional. Lowercase letters and digits. Empty uses the module's own.
SwitchDefaultWhen onCommand option
Soft deletesOnDeleted records go to the trash and can be restored.Off adds --no-soft-deletes
Gated (policy)OnA policy checks the resource's permissions on every action.Off adds --ungated
Read-onlyOffOnly list and detail screens: no create, edit or delete, and a reduced permission set (list, view and clear).--readonly
FactoryOffAlso writes a model factory for tests and seeding.--factory
The Scaffolder's Blueprint card in Resource mode, with Module, Entity and Abbreviation fields, and Soft deletes and Gated (policy) switched on while Read-only and Factory are off.

Field types

TypeDatabase column
string, select, image, fileText up to 255 characters
colorText up to 7 characters
textLong text
editorVery long text, for formatted content
integerWhole number
decimalNumber with 2 decimal places
booleanYes/no, off by default
date, datetime, timeDate, date and time, or time
json, keyValue, tagsJSON
belongsToA link to another record. Enter the Related model.

For a select field, enter the choices in Options (comma-separated).

Per-field options

OptionWhereDefaultWhat it does
NameRowLowercase letters, digits and underscores, starting with a letter.
NullableRowOffThe field can be left empty.
UniqueRowOffNo two records can have the same value.
SearchableAdvancedOffThe list's search box looks in this field.
SortableAdvancedOffThe list can be sorted by this field.
FilterableAdvancedOffThe list offers a filter for this field.
Primary columnAdvancedOffThe list's main column, which opens the record. The starting title field has it on.
TranslatableAdvancedOffThe value can be entered in each language.
On indexAdvancedOnShown as a list column.
On formAdvancedOnShown on the create and edit form.
On detailAdvancedOnShown on the record's detail page.
Scaffolder Fields section with a unit_price decimal field set to Nullable and Unique, and its Advanced panel highlighted, listing Searchable to On detail with On index, On form and On detail switched on.

Files a resource creates

Paths are inside Modules/<Module>/.

FileNotes
Database/Migrations/<timestamp>_create_<table>_table.phpThe table.
Entities/<Entity>.phpThe model.
Resources/Spa/<Entity>Resource.phpThe list, form and detail screens.
Policies/<Entity>Policy.phpThe permission checks.
Http/Controllers/BackEnd/<Entities>Controller.phpA read-only controller for a read-only resource.
Http/Requests/<Entity>/Store<Entity>Request.php, Update<Entity>Request.phpNot for read-only resources.
Services/<Entity>Service.phpNot for read-only resources.
Tests/Feature/<Entity>ResourceTest.php, Tests/Unit/<Entity>ServiceTest.phpThe unit test isn't written for read-only resources.
Database/factories/<Entity>Factory.phpOnly with Factory.

It also adds to existing module files: the routes in Routes/web.php, the policy in the module's service provider, the permissions in its permissions seeder, a menu entry in navigation.json, and the labels in Resources/lang/en.json.

Files a module shell creates

module.json, composer.json, CHANGELOG.md, README.md, the module's service provider and route provider, Config/config.php, Routes/web.php, Routes/api.php, a permissions seeder, navigation.json, Resources/lang/en.json, and release automation files.

Matching commands

ScreenCommand
Resource modephp artisan laramin:make-resource <Module> <Entity> --fields="name:string, category_id:belongsTo:Category" plus the options above
New module modephp artisan laramin:make-module <Module> --abbr=<abbr>

Permissions

In the role editor, they're under Stub Generator.

The role editor's permission list with the Stub Generator group expanded, showing 0 of 2 granted and the Scaffolder row with its View permission and Generate action.
PermissionLabelAllows
feature.stubgen.scaffolder.viewUse ScaffolderOpening the Scaffolder screen and previewing.
feature.stubgen.scaffolder.generateGenerate ScaffoldGenerate and Create module, which write files on the server.

Careful: Generate Scaffold lets someone write code into your Laramin from a browser. Give it only to developers, and only on a development copy.