Repository navigation
Support generating multiple models with a single make:model command #60379
|
Would it make sense for Example: php artisan make:model User School Student Or: php artisan make:model User,School,Student Or with existing options: php artisan make:model User School Student --all This could improve the developer experience when bootstrapping projects with many domain entities, while keeping the current single-model usage fully compatible. Is this something that would fit Laravel's philosophy, or is it intentionally left to custom commands/scripts? |
Replies: 2 comments
|
This approach is functionally equivalent to iteratively executing the Artisan model generation command for each element in a predefined list of domain entities, as exemplified below: for name in User Product Order Customer;
do php artisan make:model "$name";
done |
|
I like the idea. One suggestion would be to support a variadic argument instead of a comma-separated list:
This keeps the command consistent with other CLI tools and preserves backward compatibility. It would also be useful to print a final summary indicating which models were generated, skipped, or failed, making batch execution easier to review. For commands that generate many artifacts (such as |
This approach is functionally equivalent to iteratively executing the Artisan model generation command for each element in a predefined list of domain entities, as exemplified below: