Interactive Generator
Scaffold complete, v2-normalized CRUD resources using php artisan crud:generate.
Interactive Wizard
Run without arguments to launch the 7-step interactive wizard:
bash
php artisan crud:generateThe command renders a package and environment overview banner (version, PHP/Laravel versions, active RoleResolver, detected pages directory, chunk upload endpoint status, and config status) and walks you through:
- Select a model — Recursively scans
config('crud.generator.model_path', 'app/Models'), including nested subdirectories such asBilling/Invoice. - Route prefix — Suggests kebab-case plural (e.g.,
products). - Inertia page prefix — Suggests
Dashboard/Productsand automatically detectsresources/js/pagesvsresources/js/Pages. - Database columns — Inspects your schema via
Schema::getColumns(), maps DB column types to CRUD types, and lets you pick visible index columns. - Enabled actions — Select from
create,edit,delete,show,export, andimport. - Artifacts — Choose any combination of Controller, Policy, Inertia TSX pages (
Index.tsx,Form.tsx, plusShow.tsxautomatically when'show'is selected), andconfig/crud.phppermission entry. - Summary & generation — Confirms target paths in a formatted table and reports
CREATED,OVERWRITTEN,UPDATED, orSKIPPEDper artifact.
Non-Interactive Mode
Pass --model (or -M) for scriptable, non-interactive scaffolding:
bash
php artisan crud:generate --model=Product --allbash
php artisan crud:generate \
--model=Billing/Invoice \
--route-prefix=invoices \
--page-prefix=Admin/Billing/Invoices \
--actions=create,edit,delete,show,export,import \
--allbash
php artisan crud:generate --model=Product --policy --forceCLI Options
| Option | Description |
|---|---|
--model, -M | Model name relative to app/Models (e.g. Product or Billing/Invoice) |
--route-prefix | Route prefix & permission key (defaults to kebab-plural model name) |
--page-prefix | Inertia page directory (e.g. Dashboard/Products) |
--controller-namespace | Target controller namespace override |
--actions | Comma-separated actions (create,edit,delete,show,export,import) |
--policy | Generate a BaseCrudPolicy subclass |
--pages | Generate normalized Index.tsx, Form.tsx, and Show.tsx (when 'show' is in actions) |
--permissions | Add resource entry to config/crud.php |
--all | Generate controller, policy, pages, and config entry |
--force | Overwrite existing files |
Customizing Stubs
Publish the package stubs to stubs/crud/:
bash
php artisan vendor:publish --tag=crud-stubsThe generator automatically checks stubs/crud/ before falling back to package defaults:
stubs/crud/CrudController.stubstubs/crud/CrudPolicy.stubstubs/crud/IndexPage.stubstubs/crud/FormPage.stubstubs/crud/ShowPage.stub
Verify After Scaffolding
Run php artisan crud:doctor after registering your route to verify policy registration, config/crud.php resource keys, routes, storage disks, and queue settings.