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

Make make:model -fa behave correctly #19985

Merged
merged 5 commits into from
Jul 13, 2017
Merged

Make make:model -fa behave correctly #19985

merged 5 commits into from
Jul 13, 2017

Conversation

fredlahde
Copy link
Contributor

Currently, invoking make:model -fa Car creates the factory class CarFactory.php, which ultimately creates App\CarFactory::class.

So, it wants to create itself instead of the corresponding model.

To fix this, i've added an optional argument model to make:factory, which specifies the model to create.

Further, make:model -fa now calls make:factory with the correct arguments.

Let me now what you think.

Happy crafting 🔨

@taylorotwell
Copy link
Member

Just reverted the broken commit that caused this.

@fredlahde
Copy link
Contributor Author

Okey, after updating my test project to the current master, i get this after invoking php artisan make:model Post -fa:

image

I don't think that this is intended behaviour.

@vits
Copy link

vits commented Jul 12, 2017

make:model -fa is still broken in latest dev-master (e37d487). It creates factory for wrong model, as noted by @fredlahde and puts it in PostFactoryFactory.php file.

Besides, it also creates controller and migration files. It seems that -fa is interpreted as -a somewhere else in make options parser. Using long name --factory works as expected.

@taylorotwell taylorotwell reopened this Jul 13, 2017
@taylorotwell taylorotwell merged commit 4087ab3 into laravel:master Jul 13, 2017
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.

None yet

3 participants