Skip to content

Create Multiple Models in one command #40718

Closed Answered by chuckrincon
ousid asked this question in Ideas
Discussion options

You must be logged in to vote

The question is: Is it a good Idea to create a PR for it, or it's just a waste of time?

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:

for name in {Product,Order,Invoice}; do php artisan make:model -a "$name"; done

Or using the flags --migration, --factory, --seed and --controller:

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 make command:

php artisan make:models --all Product Order Invoice

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@ousid
Comment options

Answer selected by ousid
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants