Repository navigation
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 InvoiceWith 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. |
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"; doneOr using the flags for name in {Product,Order,Invoice}; do php artisan make:model -m -f -s -c "$name"; doneAlternatively you could create a package to offer this functionality, with a different php artisan make:models --all Product Order Invoice |
|
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. |
It's a good idea for a PR but probably it will be rejected for adding unnecessary complexity to the command.
You could use
bashfor achieve the same results:Using the flag
--all:Or using the flags
--migration,--factory,--seedand--controller:Alternatively you could create a package to offer this functionality, with a different
makecommand: