Create Multiple Models in one command #40718
-
I have been thinking lately on this idea, and on creating a Creating Multiple Models in one command like: php artisan make:model Product Order Invoice With this it creates the following model all at once, and maybe can add flags The question is: Is it a good Idea to create a PR for it, or it's just a waste of time? Hints on this, would be much appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
It's a good idea for a PR but probably it will be rejected for adding unnecessary complexity to the command. You could use Using the flag for name in {Product,Order,Invoice}; do php artisan make:model -a "$name"; done Or using the flags for name in {Product,Order,Invoice}; do php artisan make:model -m -f -s -c "$name"; done Alternatively you could create a package to offer this functionality, with a different php artisan make:models --all Product Order Invoice |
Beta Was this translation helpful? Give feedback.
-
Thanks, @chuckrincon for your detailed answer. Yeah, the package idea would be great, instead of adding complexity to the command itself, especially the newcomers. I'll work on a package as soon as I can. |
Beta Was this translation helpful? Give feedback.
It's a good idea for a PR but probably it will be rejected for adding unnecessary complexity to the command.
You could use
bash
for achieve the same results:Using the flag
--all
:Or using the flags
--migration
,--factory
,--seed
and--controller
:Alternatively you could create a package to offer this functionality, with a different
make
command: