Skip to content

feat: support multiple names for all make:* commands #1534

Description

@goravel-coder

Description

PR #1498 added multi-name support to make:command, make:controller, make:middleware and make:request (fixes goravel/goravel#880):

./artisan make:controller UserController OrderController

This issue extends the same behavior to the remaining make:* commands, so all of them accept multiple names in a single invocation (mirroring mkdir).

Tasks

  • Refactor each command's Handle into a MakeNames loop + makeOne(ctx, name) method (same pattern as feat: [#880] make commands accept multiple names #1498)
  • make:modeldatabase/console/model_make_command.go
  • make:seederdatabase/console/seeder_make_command.go
  • make:factorydatabase/console/factory_make_command.go
  • make:observerdatabase/console/observer_make_command.go
  • make:migrationdatabase/console/migration/migrate_make_command.go
  • make:channelbroadcasting/console/channel_make_command.go
  • make:policyauth/console/policy_make_command.go
  • make:notificationnotification/console/make_command.go
  • make:mailmail/console/mail_make_command.go
  • make:providerfoundation/console/provider_make_command.go
  • make:testfoundation/console/test_make_command.go
  • make:toolai/console/tool_make_command.go
  • make:agentai/console/agent_make_command.go
  • make:jobqueue/console/job_make_command.go
  • make:listenerevent/console/listener_make_command.go
  • make:eventevent/console/event_make_command.go
  • make:rulevalidation/console/rule_make_command.go
  • make:filtervalidation/console/filter_make_command.go
  • make:viewview/console/view_make_command.go (add interactive Ask prompt on empty name, then loop)
  • make:packagefoundation/console/package_make_command.go (loop over multiple package names)

Additional requirements

  • Restrict --table (make:model) and --model (make:migration) to single-name invocations — error out when combined with more than one name (declare the error as a named variable in errors/list.go, not inline)
  • Fix pre-existing bug: make:command SomeName without a sub-directory (e.g. CleanCache vs Goravel/CleanCache) registers &commands.CleanCache{} in kernel.go, corrupting it. Either register it correctly or fail with a clear message
  • Add TestXxxMakeCommand_MultipleNames for every command
  • Add a partial-failure test (a failing name must not abort the remaining names)
  • Add a guard test for --table/--model combined with multiple names

Acceptance criteria

./artisan make:model User Task              # creates both models
./artisan make:event UserRegistered OrderShipped   # creates both events
./artisan make:view home about              # creates home.tmpl, about.tmpl
./artisan make:package blog docs            # creates two package scaffolds
./artisan make:model User Order --table=users   # → error: --table requires a single name

References

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions