context:make Command¶
Last updated: 2025-10-09 (Europe/Paris)
The single entry point for RawDigs scaffolding. Use it like Laravel’s native make:* generators for individual artifacts, or omit the type to scaffold an entire bundle (model, controllers, requests, policies, etc.) in one pass.
Two Modes At A Glance¶
- Single artifact:
php artisan context:make {type} {name} [options] --context={Context} - Bundle scaffolding:
php artisan context:make {Name} [--model --controller --requests ...] --context={Context}
If you skip the second argument, the command switches to bundle mode and either honours the flags you pass or opens an interactive multiselect prompt.
Single-Artifact Mode¶
Examples:
php artisan context:make model Track --context=Catalog --with-migration
php artisan context:make controller Track --context=Catalog --resource
php artisan context:make request Track --context=Catalog --variant=Store
php artisan context:make repository Track --context=Catalog
php artisan context:make middleware EnsureTrackPublished --context=Catalog
Supported types (aliases in parentheses):
model(--with-migration)migrationcontroller(--resource)api-controllerrequest/requests(--variant=Store|Update)factorypolicyresourcefilament-resourcerepositoryactiondtocontractprovidereventmiddlewareobserverjobnotificationlistenermail/mailablerulecastscopetraitenumseedercommandconfiginterface
Under the hood the command shells out to Laravel’s generators (make:model, make:controller, make:request, etc.), then relocates the resulting files into app/Contexts/{Context}/… while fixing namespaces and imports.
Bundle Mode (Multi-Scaffold)¶
Generate everything for a bounded context resource in a single run:
php artisan context:make Track --context=Catalog --model --migration --controller --requests --policy --resource --repository
Flags map directly to the artifacts that will be generated. If you omit them, the CLI opens an interactive prompt so you can pick what you need.
| Flag | Type generated | Output (after relocation) |
|---|---|---|
--model |
Model | app/Contexts/{Context}/Models/{Name}.php |
--migration |
Migration | database/migrations/*create_{name}_table.php |
--controller |
Inertia/web controller (resourceful) | app/Contexts/{Context}/Http/Controllers/{Name}Controller.php |
--api |
API controller | app/Contexts/{Context}/Http/Controllers/{Name}ApiController.php |
--requests |
Store/Update form requests | app/Contexts/{Context}/Http/Requests/{Name}/ |
--middleware |
HTTP middleware | app/Contexts/{Context}/Http/Middleware/{Name}Middleware.php |
--factory |
Eloquent factory | database/factories/{Context}/{Name}Factory.php |
--policy |
Policy | app/Contexts/{Context}/Policies/{Name}Policy.php |
--resource |
API Resource class | app/Contexts/{Context}/Http/Resources/{Name}Resource.php |
--filament |
Filament resource | app/Filament/Resources/{Context}/{Name}Resource.php |
--repository |
Repository + contract binding | app/Contexts/{Context}/Repositories/{Name}Repository.php |
--action |
Action class | app/Contexts/{Context}/Actions/{Name}Action.php |
--dto |
DTO stub | app/Contexts/{Context}/DTOs/{Name}Data.php |
--contract |
Contract interface | app/Contexts/{Context}/Contracts/{Name}Contract.php |
--provider |
Context service provider | app/Contexts/{Context}/Providers/{Name}ServiceProvider.php |
--event |
Domain event | app/Contexts/{Context}/Events/{Name}.php |
--observer |
Model observer | app/Contexts/{Context}/Observers/{Name}Observer.php |
--job |
Queue job | app/Contexts/{Context}/Jobs/{Name}.php |
--notification |
Notification | app/Contexts/{Context}/Notifications/{Name}.php |
--listener |
Event listener | app/Contexts/{Context}/Listeners/{Name}.php |
--mail |
Mailable | app/Contexts/{Context}/Mail/{Name}.php |
--rule |
Validation rule | app/Contexts/{Context}/Rules/{Name}.php |
--cast |
Eloquent cast | app/Contexts/{Context}/Casts/{Name}.php |
--scope |
Query scope | app/Contexts/{Context}/Scopes/{Name}Scope.php |
--trait |
Trait | app/Contexts/{Context}/Traits/{Name}.php |
--enum |
PHP enum | app/Contexts/{Context}/Enums/{Name}.php |
--seeder |
Seeder | database/seeders/{Name}Seeder.php |
--command |
Console command | app/Console/Commands/{Name}.php |
--config |
Config file | config/{name_snake}.php |
--interface |
Contract interface | app/Contracts/{Name}.php (falls back to app/Interfaces) |
--force |
Force overwrite | Passed through to each generated artifact |
The controller option automatically generates a resourceful controller; selecting the API controller adds an *ApiController alongside it. When both --model and --migration are chosen, a migration stub named create_{plural}_table is generated alongside the model.
Composer Wrapper¶
Composer scripts provide the same Sail-aware shortcut:
composer run context:make -- Track --context=Catalog --model --migration
Everything after -- is passed straight to the command. Use composer run context:delete -- Track --context=Catalog when you need the teardown helper.
Output Summary¶
Depending on what you scaffold, expect files under:
app/Contexts/{Context}/Models/{Name}.phpapp/Contexts/{Context}/Http/Controllers/{Name}Controller.phpapp/Contexts/{Context}/Http/Controllers/{Name}ApiController.phpapp/Contexts/{Context}/Http/Requests/{Name}/{Store|Update}{Name}Request.phpapp/Contexts/{Context}/Http/Middleware/{Name}Middleware.phpapp/Contexts/{Context}/Http/Resources/{Name}Resource.phpapp/Contexts/{Context}/Policies/{Name}Policy.phpapp/Contexts/{Context}/Repositories/{Name}Repository.phpapp/Contexts/{Context}/Actions/{Name}Action.phpapp/Contexts/{Context}/DTOs/{Name}Data.phpapp/Contexts/{Context}/Contracts/{Name}Contract.phpapp/Contexts/{Context}/Providers/{Name}ServiceProvider.phpapp/Contexts/{Context}/Events/{Name}.phpapp/Contexts/{Context}/Observers/{Name}Observer.phpapp/Contexts/{Context}/Jobs/{Name}.phpapp/Contexts/{Context}/Notifications/{Name}.phpapp/Contexts/{Context}/Listeners/{Name}.phpapp/Contexts/{Context}/Mail/{Name}.phpapp/Contexts/{Context}/Rules/{Name}.phpapp/Contexts/{Context}/Casts/{Name}.phpapp/Contexts/{Context}/Scopes/{Name}Scope.phpapp/Contexts/{Context}/Traits/{Name}.phpapp/Contexts/{Context}/Enums/{Name}.phpdatabase/factories/{Context}/{Name}Factory.phpdatabase/migrations/*create_{name_plural}_table.phpdatabase/seeders/{Name}Seeder.phpapp/Console/Commands/{Name}.phpconfig/{name_snake}.phpapp/Contracts/{Name}.php(falls back toapp/Interfaces)app/Filament/Resources/{Context}/{Name}Resource.php
Related Docs¶
docs/cli/index.mddocs/commands/context-delete.md