DevTools: Discovery & Generation
Discovery scans Eloquent models and prints suggestions for SeviaFlow Resources. It does not decide your application's business rules. Use it to get a first draft, then review the generated code and choose which Resource slugs to register.
Recommended workflow
- Install
seviaflow/devtoolsas a development dependency and confirm the database connection works. - Run discovery without generation. This is the default report-only mode and does not write files.
- Add
--with-schemato inspect database columns and see field, filter, relation, and workflow suggestions. - Limit the scan with
--models=Customer,Orderif you want to review only selected models. - When the suggestions look useful, add
--generateto write the Resource, form, and table starting files. - Copy the printed Resource registration entry into the existing
resourcesmap inconfig/seviaflow.php, then edit and test the generated definitions.
php artisan seviaflow:discover --models=Customer,Order --with-schema
php artisan seviaflow:discover --models=Customer --with-schema --generate
The first command only reports suggestions. The second writes files for the selected model. If a generated file already exists, generation stops unless you pass --force; that option permits overwriting generated files, so review the targets first.
Discovery options
| Option | Effect |
|---|---|
--models=Customer,Order | Includes only the named models from the configured scan. |
--path=app/Domain/Models | Scans a different model directory for this command run. |
--ignored=App\Models\AuditLog | Adds model classes to the ignored list for this run. |
--with-schema | Reads table columns and produces additional field, filter, relation, and workflow suggestions. The database must be reachable and the model table must exist. |
--generate | Writes Resource, form, and table starter files and prints a registration snippet. |
--force | Allows generated files to replace existing files when generation is enabled. |
--dry-run | Prints a report-only status line. It does not override --generate; omit --generate whenever you want to guarantee that no files are written. |
What the suggestions mean
Without --with-schema, discovery can report model metadata such as its table, primary key, fillable/guarded attributes, and casts. With schema inspection enabled, it can suggest input fields, filters, Eloquent relations, and candidate workflow fields. A suggestion is not a policy or a complete domain model: check every field against your application's requirements and remove sensitive or irrelevant data.
Generated resources are written below app/SeviaFlow/Resources in the App\SeviaFlow\Resources namespace by default. A generated Resource is not available in the UI or API until you register its slug in config/seviaflow.php. See Resource Registration for the next step.
Discovery defaults
| Key | Default | Meaning |
|---|---|---|
discovery.enabled | true | Enables model discovery commands. |
discovery.model_paths | app_path('Models') | Folders scanned for Eloquent models. |
discovery.model_namespaces | App\Models | Namespaces used for discovered classes. |
discovery.ignored_models | [] | Model classes to skip on every run. |
Generation defaults
| Key | Default | Meaning |
|---|---|---|
generation.resources_path | app_path('SeviaFlow/Resources') | Folder where generated Resource files are written. |
generation.resources_namespace | App\SeviaFlow\Resources | PHP namespace used by generated classes. |
generation.stubs_path | base_path('stubs/seviaflow') | Optional host-application stubs used to customize generated output. |
For the full command list and option behavior, see DevTools Commands.
Get Started