Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.5] Fix make:model factory option behavior #20798

Closed
wants to merge 1 commit into from
Closed

[5.5] Fix make:model factory option behavior #20798

wants to merge 1 commit into from

Conversation

srmklive
Copy link
Contributor

@srmklive srmklive commented Aug 28, 2017

As pointed out in #20793 by @paulredmond, when we run the command:

php artisan make:model -fa Category

it performs all tasks that are done by all option for make:model command, but it should simply create a model & a factory.

This PR achieves the desired behavior by renaming the factory option to s (could be better short code. But i used s because it is indirectly a seeder to a table).

@paulredmond
Copy link
Contributor

I feel like I'd be creating factories more than I would use --force. Does everything need a short version as a convention? That way -f could be used for the factory.

@srmklive
Copy link
Contributor Author

@paulredmond Yes every command option needs a short code as a convention. This is needed because not everyone likes to type the full option name when running a command. Why i think in this case having the f short code for force is needed.

@browner12
Copy link
Contributor

yah, @paulredmond, that seems like a good suggestion, since force will not be a common action.

every command does not need a short code. it looks like the underlying symfony command allows you to pass in null for the shortcode. you may want the shortcode but it is not required.

in fact, if you run artisan help route:list, you'll see that there are plenty of options that don't have a 1 letter short code.

@browner12
Copy link
Contributor

there is also precedence for this with the migrate command.

php artisan help migrate

you'll see the force option does not have a short code

@paulredmond
Copy link
Contributor

paulredmond commented Aug 28, 2017

As a user, I would probably use --force anyway, because it's less mental overhead and a convention I use elsewhere (i.e., git)

@browner12
Copy link
Contributor

Paul, I'd go with this for the PR. remove the short code for force, and switch factory to an f.

@taylorotwell
Copy link
Member

Fixed in another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants